Completed
Push — dev ( c3eba7...760621 )
by Tristan
09:29 queued 02:32
created

?!?.?!?   F

Complexity

Conditions 23
Paths 180

Size

Total Lines 86
Code Lines 66

Duplication

Lines 86
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 66
dl 86
loc 86
rs 0
c 0
b 0
f 0
cc 23
nc 180
nop 1

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

Complexity

Complex classes like ?!?.?!? often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/******/ (function(modules) { // webpackBootstrap
2
/******/ 	// The module cache
3
/******/ 	var installedModules = {};
4
/******/
5
/******/ 	// The require function
6
/******/ 	function __webpack_require__(moduleId) {
7
/******/
8
/******/ 		// Check if module is in cache
9
/******/ 		if(installedModules[moduleId])
10
/******/ 			return installedModules[moduleId].exports;
11
/******/
12
/******/ 		// Create a new module (and put it into the cache)
13
/******/ 		var module = installedModules[moduleId] = {
14
/******/ 			i: moduleId,
15
/******/ 			l: false,
16
/******/ 			exports: {}
17
/******/ 		};
18
/******/
19
/******/ 		// Execute the module function
20
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
/******/
22
/******/ 		// Flag the module as loaded
23
/******/ 		module.l = true;
24
/******/
25
/******/ 		// Return the exports of the module
26
/******/ 		return module.exports;
27
/******/ 	}
28
/******/
29
/******/
30
/******/ 	// expose the modules object (__webpack_modules__)
31
/******/ 	__webpack_require__.m = modules;
32
/******/
33
/******/ 	// expose the module cache
34
/******/ 	__webpack_require__.c = installedModules;
35
/******/
36
/******/ 	// identity function for calling harmony imports with the correct context
37
/******/ 	__webpack_require__.i = function(value) { return value; };
38
/******/
39
/******/ 	// define getter function for harmony exports
40
/******/ 	__webpack_require__.d = function(exports, name, getter) {
41
/******/ 		if(!__webpack_require__.o(exports, name)) {
42
/******/ 			Object.defineProperty(exports, name, {
43
/******/ 				configurable: false,
44
/******/ 				enumerable: true,
45
/******/ 				get: getter
46
/******/ 			});
47
/******/ 		}
48
/******/ 	};
49
/******/
50
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
51
/******/ 	__webpack_require__.n = function(module) {
52
/******/ 		var getter = module && module.__esModule ?
53
/******/ 			function getDefault() { return module['default']; } :
54
/******/ 			function getModuleExports() { return module; };
55
/******/ 		__webpack_require__.d(getter, 'a', getter);
56
/******/ 		return getter;
57
/******/ 	};
58
/******/
59
/******/ 	// Object.prototype.hasOwnProperty.call
60
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
61
/******/
62
/******/ 	// __webpack_public_path__
63
/******/ 	__webpack_require__.p = "./";
64
/******/
65
/******/ 	// Load entry module and return exports
66
/******/ 	return __webpack_require__(__webpack_require__.s = 6);
67
/******/ })
68
/************************************************************************/
69
/******/ ([
70
/* 0 */
71
/***/ (function(module, exports, __webpack_require__) {
72
73
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
74
 * jQuery JavaScript Library v3.3.1
75
 * https://jquery.com/
76
 *
77
 * Includes Sizzle.js
78
 * https://sizzlejs.com/
79
 *
80
 * Copyright JS Foundation and other contributors
81
 * Released under the MIT license
82
 * https://jquery.org/license
83
 *
84
 * Date: 2018-01-20T17:24Z
85
 */
86
( function( global, factory ) {
87
88
	"use strict";
89
90
	if ( typeof module === "object" && typeof module.exports === "object" ) {
91
92
		// For CommonJS and CommonJS-like environments where a proper `window`
93
		// is present, execute the factory and get jQuery.
94
		// For environments that do not have a `window` with a `document`
95
		// (such as Node.js), expose a factory as module.exports.
96
		// This accentuates the need for the creation of a real `window`.
97
		// e.g. var jQuery = require("jquery")(window);
98
		// See ticket #14549 for more info.
99
		module.exports = global.document ?
100
			factory( global, true ) :
101
			function( w ) {
102
				if ( !w.document ) {
103
					throw new Error( "jQuery requires a window with a document" );
104
				}
105
				return factory( w );
106
			};
107
	} else {
108
		factory( global );
109
	}
110
111
// Pass this if window is not defined yet
112
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
113
114
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
115
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
116
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
117
// enough that all such attempts are guarded in a try block.
118
"use strict";
119
120
var arr = [];
121
122
var document = window.document;
123
124
var getProto = Object.getPrototypeOf;
125
126
var slice = arr.slice;
127
128
var concat = arr.concat;
129
130
var push = arr.push;
131
132
var indexOf = arr.indexOf;
133
134
var class2type = {};
135
136
var toString = class2type.toString;
137
138
var hasOwn = class2type.hasOwnProperty;
139
140
var fnToString = hasOwn.toString;
141
142
var ObjectFunctionString = fnToString.call( Object );
143
144
var support = {};
145
146
var isFunction = function isFunction( obj ) {
147
148
      // Support: Chrome <=57, Firefox <=52
149
      // In some browsers, typeof returns "function" for HTML <object> elements
150
      // (i.e., `typeof document.createElement( "object" ) === "function"`).
151
      // We don't want to classify *any* DOM node as a function.
152
      return typeof obj === "function" && typeof obj.nodeType !== "number";
153
  };
154
155
156
var isWindow = function isWindow( obj ) {
157
		return obj != null && obj === obj.window;
158
	};
159
160
161
162
163
	var preservedScriptAttributes = {
164
		type: true,
165
		src: true,
166
		noModule: true
167
	};
168
169
	function DOMEval( code, doc, node ) {
170
		doc = doc || document;
171
172
		var i,
173
			script = doc.createElement( "script" );
174
175
		script.text = code;
176
		if ( node ) {
177
			for ( i in preservedScriptAttributes ) {
178
				if ( node[ i ] ) {
179
					script[ i ] = node[ i ];
180
				}
181
			}
182
		}
183
		doc.head.appendChild( script ).parentNode.removeChild( script );
184
	}
185
186
187
function toType( obj ) {
188
	if ( obj == null ) {
189
		return obj + "";
190
	}
191
192
	// Support: Android <=2.3 only (functionish RegExp)
193
	return typeof obj === "object" || typeof obj === "function" ?
194
		class2type[ toString.call( obj ) ] || "object" :
195
		typeof obj;
196
}
197
/* global Symbol */
198
// Defining this global in .eslintrc.json would create a danger of using the global
199
// unguarded in another place, it seems safer to define global only for this module
200
201
202
203
var
204
	version = "3.3.1",
205
206
	// Define a local copy of jQuery
207
	jQuery = function( selector, context ) {
208
209
		// The jQuery object is actually just the init constructor 'enhanced'
210
		// Need init if jQuery is called (just allow error to be thrown if not included)
211
		return new jQuery.fn.init( selector, context );
212
	},
213
214
	// Support: Android <=4.0 only
215
	// Make sure we trim BOM and NBSP
216
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
217
218
jQuery.fn = jQuery.prototype = {
219
220
	// The current version of jQuery being used
221
	jquery: version,
222
223
	constructor: jQuery,
224
225
	// The default length of a jQuery object is 0
226
	length: 0,
227
228
	toArray: function() {
229
		return slice.call( this );
230
	},
231
232
	// Get the Nth element in the matched element set OR
233
	// Get the whole matched element set as a clean array
234
	get: function( num ) {
235
236
		// Return all the elements in a clean array
237
		if ( num == null ) {
238
			return slice.call( this );
239
		}
240
241
		// Return just the one element from the set
242
		return num < 0 ? this[ num + this.length ] : this[ num ];
243
	},
244
245
	// Take an array of elements and push it onto the stack
246
	// (returning the new matched element set)
247
	pushStack: function( elems ) {
248
249
		// Build a new jQuery matched element set
250
		var ret = jQuery.merge( this.constructor(), elems );
251
252
		// Add the old object onto the stack (as a reference)
253
		ret.prevObject = this;
254
255
		// Return the newly-formed element set
256
		return ret;
257
	},
258
259
	// Execute a callback for every element in the matched set.
260
	each: function( callback ) {
261
		return jQuery.each( this, callback );
262
	},
263
264
	map: function( callback ) {
265
		return this.pushStack( jQuery.map( this, function( elem, i ) {
266
			return callback.call( elem, i, elem );
267
		} ) );
268
	},
269
270
	slice: function() {
271
		return this.pushStack( slice.apply( this, arguments ) );
272
	},
273
274
	first: function() {
275
		return this.eq( 0 );
276
	},
277
278
	last: function() {
279
		return this.eq( -1 );
280
	},
281
282
	eq: function( i ) {
283
		var len = this.length,
284
			j = +i + ( i < 0 ? len : 0 );
285
		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
286
	},
287
288
	end: function() {
289
		return this.prevObject || this.constructor();
290
	},
291
292
	// For internal use only.
293
	// Behaves like an Array's method, not like a jQuery method.
294
	push: push,
295
	sort: arr.sort,
296
	splice: arr.splice
297
};
298
299
jQuery.extend = jQuery.fn.extend = function() {
300
	var options, name, src, copy, copyIsArray, clone,
301
		target = arguments[ 0 ] || {},
302
		i = 1,
303
		length = arguments.length,
304
		deep = false;
305
306
	// Handle a deep copy situation
307
	if ( typeof target === "boolean" ) {
308
		deep = target;
309
310
		// Skip the boolean and the target
311
		target = arguments[ i ] || {};
312
		i++;
313
	}
314
315
	// Handle case when target is a string or something (possible in deep copy)
316
	if ( typeof target !== "object" && !isFunction( target ) ) {
317
		target = {};
318
	}
319
320
	// Extend jQuery itself if only one argument is passed
321
	if ( i === length ) {
322
		target = this;
323
		i--;
324
	}
325
326
	for ( ; i < length; i++ ) {
327
328
		// Only deal with non-null/undefined values
329
		if ( ( options = arguments[ i ] ) != null ) {
330
331
			// Extend the base object
332
			for ( name in options ) {
333
				src = target[ name ];
334
				copy = options[ name ];
335
336
				// Prevent never-ending loop
337
				if ( target === copy ) {
338
					continue;
339
				}
340
341
				// Recurse if we're merging plain objects or arrays
342
				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
343
					( copyIsArray = Array.isArray( copy ) ) ) ) {
344
345
					if ( copyIsArray ) {
346
						copyIsArray = false;
347
						clone = src && Array.isArray( src ) ? src : [];
348
349
					} else {
350
						clone = src && jQuery.isPlainObject( src ) ? src : {};
351
					}
352
353
					// Never move original objects, clone them
354
					target[ name ] = jQuery.extend( deep, clone, copy );
355
356
				// Don't bring in undefined values
357
				} else if ( copy !== undefined ) {
358
					target[ name ] = copy;
359
				}
360
			}
361
		}
362
	}
363
364
	// Return the modified object
365
	return target;
366
};
367
368
jQuery.extend( {
369
370
	// Unique for each copy of jQuery on the page
371
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
372
373
	// Assume jQuery is ready without the ready module
374
	isReady: true,
375
376
	error: function( msg ) {
377
		throw new Error( msg );
378
	},
379
380
	noop: function() {},
381
382
	isPlainObject: function( obj ) {
383
		var proto, Ctor;
384
385
		// Detect obvious negatives
386
		// Use toString instead of jQuery.type to catch host objects
387
		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
388
			return false;
389
		}
390
391
		proto = getProto( obj );
392
393
		// Objects with no prototype (e.g., `Object.create( null )`) are plain
394
		if ( !proto ) {
395
			return true;
396
		}
397
398
		// Objects with prototype are plain iff they were constructed by a global Object function
399
		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
400
		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
401
	},
402
403
	isEmptyObject: function( obj ) {
404
405
		/* eslint-disable no-unused-vars */
406
		// See https://github.com/eslint/eslint/issues/6125
407
		var name;
408
409
		for ( name in obj ) {
410
			return false;
411
		}
412
		return true;
413
	},
414
415
	// Evaluates a script in a global context
416
	globalEval: function( code ) {
417
		DOMEval( code );
418
	},
419
420
	each: function( obj, callback ) {
421
		var length, i = 0;
422
423
		if ( isArrayLike( obj ) ) {
424
			length = obj.length;
425
			for ( ; i < length; i++ ) {
426
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
427
					break;
428
				}
429
			}
430
		} else {
431
			for ( i in obj ) {
432
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
433
					break;
434
				}
435
			}
436
		}
437
438
		return obj;
439
	},
440
441
	// Support: Android <=4.0 only
442
	trim: function( text ) {
443
		return text == null ?
444
			"" :
445
			( text + "" ).replace( rtrim, "" );
446
	},
447
448
	// results is for internal usage only
449
	makeArray: function( arr, results ) {
450
		var ret = results || [];
451
452
		if ( arr != null ) {
453
			if ( isArrayLike( Object( arr ) ) ) {
454
				jQuery.merge( ret,
455
					typeof arr === "string" ?
456
					[ arr ] : arr
457
				);
458
			} else {
459
				push.call( ret, arr );
460
			}
461
		}
462
463
		return ret;
464
	},
465
466
	inArray: function( elem, arr, i ) {
467
		return arr == null ? -1 : indexOf.call( arr, elem, i );
468
	},
469
470
	// Support: Android <=4.0 only, PhantomJS 1 only
471
	// push.apply(_, arraylike) throws on ancient WebKit
472
	merge: function( first, second ) {
473
		var len = +second.length,
474
			j = 0,
475
			i = first.length;
476
477
		for ( ; j < len; j++ ) {
478
			first[ i++ ] = second[ j ];
479
		}
480
481
		first.length = i;
482
483
		return first;
484
	},
485
486
	grep: function( elems, callback, invert ) {
487
		var callbackInverse,
488
			matches = [],
489
			i = 0,
490
			length = elems.length,
491
			callbackExpect = !invert;
492
493
		// Go through the array, only saving the items
494
		// that pass the validator function
495
		for ( ; i < length; i++ ) {
496
			callbackInverse = !callback( elems[ i ], i );
497
			if ( callbackInverse !== callbackExpect ) {
498
				matches.push( elems[ i ] );
499
			}
500
		}
501
502
		return matches;
503
	},
504
505
	// arg is for internal usage only
506
	map: function( elems, callback, arg ) {
507
		var length, value,
508
			i = 0,
509
			ret = [];
510
511
		// Go through the array, translating each of the items to their new values
512
		if ( isArrayLike( elems ) ) {
513
			length = elems.length;
514
			for ( ; i < length; i++ ) {
515
				value = callback( elems[ i ], i, arg );
516
517
				if ( value != null ) {
518
					ret.push( value );
519
				}
520
			}
521
522
		// Go through every key on the object,
523
		} else {
524
			for ( i in elems ) {
525
				value = callback( elems[ i ], i, arg );
526
527
				if ( value != null ) {
528
					ret.push( value );
529
				}
530
			}
531
		}
532
533
		// Flatten any nested arrays
534
		return concat.apply( [], ret );
535
	},
536
537
	// A global GUID counter for objects
538
	guid: 1,
539
540
	// jQuery.support is not used in Core but other projects attach their
541
	// properties to it so it needs to exist.
542
	support: support
543
} );
544
545
if ( typeof Symbol === "function" ) {
546
	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
547
}
548
549
// Populate the class2type map
550
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
551
function( i, name ) {
552
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
553
} );
554
555
function isArrayLike( obj ) {
556
557
	// Support: real iOS 8.2 only (not reproducible in simulator)
558
	// `in` check used to prevent JIT error (gh-2145)
559
	// hasOwn isn't used here due to false negatives
560
	// regarding Nodelist length in IE
561
	var length = !!obj && "length" in obj && obj.length,
562
		type = toType( obj );
563
564
	if ( isFunction( obj ) || isWindow( obj ) ) {
565
		return false;
566
	}
567
568
	return type === "array" || length === 0 ||
569
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
570
}
571
var Sizzle =
572
/*!
573
 * Sizzle CSS Selector Engine v2.3.3
574
 * https://sizzlejs.com/
575
 *
576
 * Copyright jQuery Foundation and other contributors
577
 * Released under the MIT license
578
 * http://jquery.org/license
579
 *
580
 * Date: 2016-08-08
581
 */
582
(function( window ) {
583
584
var i,
585
	support,
586
	Expr,
587
	getText,
588
	isXML,
589
	tokenize,
590
	compile,
591
	select,
592
	outermostContext,
593
	sortInput,
594
	hasDuplicate,
595
596
	// Local document vars
597
	setDocument,
598
	document,
599
	docElem,
600
	documentIsHTML,
601
	rbuggyQSA,
602
	rbuggyMatches,
603
	matches,
604
	contains,
605
606
	// Instance-specific data
607
	expando = "sizzle" + 1 * new Date(),
608
	preferredDoc = window.document,
609
	dirruns = 0,
610
	done = 0,
611
	classCache = createCache(),
612
	tokenCache = createCache(),
613
	compilerCache = createCache(),
614
	sortOrder = function( a, b ) {
615
		if ( a === b ) {
616
			hasDuplicate = true;
617
		}
618
		return 0;
619
	},
620
621
	// Instance methods
622
	hasOwn = ({}).hasOwnProperty,
623
	arr = [],
624
	pop = arr.pop,
625
	push_native = arr.push,
626
	push = arr.push,
627
	slice = arr.slice,
628
	// Use a stripped-down indexOf as it's faster than native
629
	// https://jsperf.com/thor-indexof-vs-for/5
630
	indexOf = function( list, elem ) {
631
		var i = 0,
632
			len = list.length;
633
		for ( ; i < len; i++ ) {
634
			if ( list[i] === elem ) {
635
				return i;
636
			}
637
		}
638
		return -1;
639
	},
640
641
	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
642
643
	// Regular expressions
644
645
	// http://www.w3.org/TR/css3-selectors/#whitespace
646
	whitespace = "[\\x20\\t\\r\\n\\f]",
647
648
	// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
649
	identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
650
651
	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
652
	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
653
		// Operator (capture 2)
654
		"*([*^$|!~]?=)" + whitespace +
655
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
656
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
657
		"*\\]",
658
659
	pseudos = ":(" + identifier + ")(?:\\((" +
660
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
661
		// 1. quoted (capture 3; capture 4 or capture 5)
662
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
663
		// 2. simple (capture 6)
664
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
665
		// 3. anything else (capture 2)
666
		".*" +
667
		")\\)|)",
668
669
	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
670
	rwhitespace = new RegExp( whitespace + "+", "g" ),
671
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
672
673
	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
674
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
675
676
	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
677
678
	rpseudo = new RegExp( pseudos ),
679
	ridentifier = new RegExp( "^" + identifier + "$" ),
680
681
	matchExpr = {
682
		"ID": new RegExp( "^#(" + identifier + ")" ),
683
		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
684
		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
685
		"ATTR": new RegExp( "^" + attributes ),
686
		"PSEUDO": new RegExp( "^" + pseudos ),
687
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
688
			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
689
			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
690
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
691
		// For use in libraries implementing .is()
692
		// We use this for POS matching in `select`
693
		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
694
			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
695
	},
696
697
	rinputs = /^(?:input|select|textarea|button)$/i,
698
	rheader = /^h\d$/i,
699
700
	rnative = /^[^{]+\{\s*\[native \w/,
701
702
	// Easily-parseable/retrievable ID or TAG or CLASS selectors
703
	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
704
705
	rsibling = /[+~]/,
706
707
	// CSS escapes
708
	// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
709
	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
710
	funescape = function( _, escaped, escapedWhitespace ) {
711
		var high = "0x" + escaped - 0x10000;
712
		// NaN means non-codepoint
713
		// Support: Firefox<24
714
		// Workaround erroneous numeric interpretation of +"0x"
715
		return high !== high || escapedWhitespace ?
716
			escaped :
717
			high < 0 ?
718
				// BMP codepoint
719
				String.fromCharCode( high + 0x10000 ) :
720
				// Supplemental Plane codepoint (surrogate pair)
721
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
722
	},
723
724
	// CSS string/identifier serialization
725
	// https://drafts.csswg.org/cssom/#common-serializing-idioms
726
	rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
727
	fcssescape = function( ch, asCodePoint ) {
728
		if ( asCodePoint ) {
729
730
			// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
731
			if ( ch === "\0" ) {
732
				return "\uFFFD";
733
			}
734
735
			// Control characters and (dependent upon position) numbers get escaped as code points
736
			return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
737
		}
738
739
		// Other potentially-special ASCII characters get backslash-escaped
740
		return "\\" + ch;
741
	},
742
743
	// Used for iframes
744
	// See setDocument()
745
	// Removing the function wrapper causes a "Permission Denied"
746
	// error in IE
747
	unloadHandler = function() {
748
		setDocument();
749
	},
750
751
	disabledAncestor = addCombinator(
752
		function( elem ) {
753
			return elem.disabled === true && ("form" in elem || "label" in elem);
754
		},
755
		{ dir: "parentNode", next: "legend" }
756
	);
757
758
// Optimize for push.apply( _, NodeList )
759
try {
760
	push.apply(
761
		(arr = slice.call( preferredDoc.childNodes )),
762
		preferredDoc.childNodes
763
	);
764
	// Support: Android<4.0
765
	// Detect silently failing push.apply
766
	arr[ preferredDoc.childNodes.length ].nodeType;
767
} catch ( e ) {
768
	push = { apply: arr.length ?
769
770
		// Leverage slice if possible
771
		function( target, els ) {
772
			push_native.apply( target, slice.call(els) );
773
		} :
774
775
		// Support: IE<9
776
		// Otherwise append directly
777
		function( target, els ) {
778
			var j = target.length,
779
				i = 0;
780
			// Can't trust NodeList.length
781
			while ( (target[j++] = els[i++]) ) {}
782
			target.length = j - 1;
783
		}
784
	};
785
}
786
787
function Sizzle( selector, context, results, seed ) {
788
	var m, i, elem, nid, match, groups, newSelector,
789
		newContext = context && context.ownerDocument,
790
791
		// nodeType defaults to 9, since context defaults to document
792
		nodeType = context ? context.nodeType : 9;
793
794
	results = results || [];
795
796
	// Return early from calls with invalid selector or context
797
	if ( typeof selector !== "string" || !selector ||
798
		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
799
800
		return results;
801
	}
802
803
	// Try to shortcut find operations (as opposed to filters) in HTML documents
804
	if ( !seed ) {
805
806
		if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
807
			setDocument( context );
808
		}
809
		context = context || document;
810
811
		if ( documentIsHTML ) {
812
813
			// If the selector is sufficiently simple, try using a "get*By*" DOM method
814
			// (excepting DocumentFragment context, where the methods don't exist)
815
			if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
816
817
				// ID selector
818
				if ( (m = match[1]) ) {
819
820
					// Document context
821
					if ( nodeType === 9 ) {
822
						if ( (elem = context.getElementById( m )) ) {
823
824
							// Support: IE, Opera, Webkit
825
							// TODO: identify versions
826
							// getElementById can match elements by name instead of ID
827
							if ( elem.id === m ) {
828
								results.push( elem );
829
								return results;
830
							}
831
						} else {
832
							return results;
833
						}
834
835
					// Element context
836
					} else {
837
838
						// Support: IE, Opera, Webkit
839
						// TODO: identify versions
840
						// getElementById can match elements by name instead of ID
841
						if ( newContext && (elem = newContext.getElementById( m )) &&
842
							contains( context, elem ) &&
843
							elem.id === m ) {
844
845
							results.push( elem );
846
							return results;
847
						}
848
					}
849
850
				// Type selector
851
				} else if ( match[2] ) {
852
					push.apply( results, context.getElementsByTagName( selector ) );
853
					return results;
854
855
				// Class selector
856
				} else if ( (m = match[3]) && support.getElementsByClassName &&
857
					context.getElementsByClassName ) {
858
859
					push.apply( results, context.getElementsByClassName( m ) );
860
					return results;
861
				}
862
			}
863
864
			// Take advantage of querySelectorAll
865
			if ( support.qsa &&
866
				!compilerCache[ selector + " " ] &&
867
				(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
868
869
				if ( nodeType !== 1 ) {
870
					newContext = context;
871
					newSelector = selector;
872
873
				// qSA looks outside Element context, which is not what we want
874
				// Thanks to Andrew Dupont for this workaround technique
875
				// Support: IE <=8
876
				// Exclude object elements
877
				} else if ( context.nodeName.toLowerCase() !== "object" ) {
878
879
					// Capture the context ID, setting it first if necessary
880
					if ( (nid = context.getAttribute( "id" )) ) {
881
						nid = nid.replace( rcssescape, fcssescape );
882
					} else {
883
						context.setAttribute( "id", (nid = expando) );
884
					}
885
886
					// Prefix every selector in the list
887
					groups = tokenize( selector );
888
					i = groups.length;
889
					while ( i-- ) {
890
						groups[i] = "#" + nid + " " + toSelector( groups[i] );
891
					}
892
					newSelector = groups.join( "," );
893
894
					// Expand context for sibling selectors
895
					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
896
						context;
897
				}
898
899
				if ( newSelector ) {
900
					try {
901
						push.apply( results,
902
							newContext.querySelectorAll( newSelector )
903
						);
904
						return results;
905
					} catch ( qsaError ) {
906
					} finally {
907
						if ( nid === expando ) {
908
							context.removeAttribute( "id" );
909
						}
910
					}
911
				}
912
			}
913
		}
914
	}
915
916
	// All others
917
	return select( selector.replace( rtrim, "$1" ), context, results, seed );
918
}
919
920
/**
921
 * Create key-value caches of limited size
922
 * @returns {function(string, object)} Returns the Object data after storing it on itself with
923
 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
924
 *	deleting the oldest entry
925
 */
926
function createCache() {
927
	var keys = [];
928
929
	function cache( key, value ) {
930
		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
931
		if ( keys.push( key + " " ) > Expr.cacheLength ) {
932
			// Only keep the most recent entries
933
			delete cache[ keys.shift() ];
934
		}
935
		return (cache[ key + " " ] = value);
936
	}
937
	return cache;
938
}
939
940
/**
941
 * Mark a function for special use by Sizzle
942
 * @param {Function} fn The function to mark
943
 */
944
function markFunction( fn ) {
945
	fn[ expando ] = true;
946
	return fn;
947
}
948
949
/**
950
 * Support testing using an element
951
 * @param {Function} fn Passed the created element and returns a boolean result
952
 */
953
function assert( fn ) {
954
	var el = document.createElement("fieldset");
955
956
	try {
957
		return !!fn( el );
958
	} catch (e) {
959
		return false;
960
	} finally {
961
		// Remove from its parent by default
962
		if ( el.parentNode ) {
963
			el.parentNode.removeChild( el );
964
		}
965
		// release memory in IE
966
		el = null;
967
	}
968
}
969
970
/**
971
 * Adds the same handler for all of the specified attrs
972
 * @param {String} attrs Pipe-separated list of attributes
973
 * @param {Function} handler The method that will be applied
974
 */
975
function addHandle( attrs, handler ) {
976
	var arr = attrs.split("|"),
977
		i = arr.length;
978
979
	while ( i-- ) {
980
		Expr.attrHandle[ arr[i] ] = handler;
981
	}
982
}
983
984
/**
985
 * Checks document order of two siblings
986
 * @param {Element} a
987
 * @param {Element} b
988
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
989
 */
990
function siblingCheck( a, b ) {
991
	var cur = b && a,
992
		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
993
			a.sourceIndex - b.sourceIndex;
994
995
	// Use IE sourceIndex if available on both nodes
996
	if ( diff ) {
997
		return diff;
998
	}
999
1000
	// Check if b follows a
1001
	if ( cur ) {
1002
		while ( (cur = cur.nextSibling) ) {
1003
			if ( cur === b ) {
1004
				return -1;
1005
			}
1006
		}
1007
	}
1008
1009
	return a ? 1 : -1;
1010
}
1011
1012
/**
1013
 * Returns a function to use in pseudos for input types
1014
 * @param {String} type
1015
 */
1016
function createInputPseudo( type ) {
1017
	return function( elem ) {
1018
		var name = elem.nodeName.toLowerCase();
1019
		return name === "input" && elem.type === type;
1020
	};
1021
}
1022
1023
/**
1024
 * Returns a function to use in pseudos for buttons
1025
 * @param {String} type
1026
 */
1027
function createButtonPseudo( type ) {
1028
	return function( elem ) {
1029
		var name = elem.nodeName.toLowerCase();
1030
		return (name === "input" || name === "button") && elem.type === type;
1031
	};
1032
}
1033
1034
/**
1035
 * Returns a function to use in pseudos for :enabled/:disabled
1036
 * @param {Boolean} disabled true for :disabled; false for :enabled
1037
 */
1038
function createDisabledPseudo( disabled ) {
1039
1040
	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1041
	return function( elem ) {
1042
1043
		// Only certain elements can match :enabled or :disabled
1044
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1045
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1046
		if ( "form" in elem ) {
1047
1048
			// Check for inherited disabledness on relevant non-disabled elements:
1049
			// * listed form-associated elements in a disabled fieldset
1050
			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
1051
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1052
			// * option elements in a disabled optgroup
1053
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1054
			// All such elements have a "form" property.
1055
			if ( elem.parentNode && elem.disabled === false ) {
1056
1057
				// Option elements defer to a parent optgroup if present
1058
				if ( "label" in elem ) {
1059
					if ( "label" in elem.parentNode ) {
1060
						return elem.parentNode.disabled === disabled;
1061
					} else {
1062
						return elem.disabled === disabled;
1063
					}
1064
				}
1065
1066
				// Support: IE 6 - 11
1067
				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
1068
				return elem.isDisabled === disabled ||
1069
1070
					// Where there is no isDisabled, check manually
1071
					/* jshint -W018 */
1072
					elem.isDisabled !== !disabled &&
1073
						disabledAncestor( elem ) === disabled;
1074
			}
1075
1076
			return elem.disabled === disabled;
1077
1078
		// Try to winnow out elements that can't be disabled before trusting the disabled property.
1079
		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1080
		// even exist on them, let alone have a boolean value.
1081
		} else if ( "label" in elem ) {
1082
			return elem.disabled === disabled;
1083
		}
1084
1085
		// Remaining elements are neither :enabled nor :disabled
1086
		return false;
1087
	};
1088
}
1089
1090
/**
1091
 * Returns a function to use in pseudos for positionals
1092
 * @param {Function} fn
1093
 */
1094
function createPositionalPseudo( fn ) {
1095
	return markFunction(function( argument ) {
1096
		argument = +argument;
1097
		return markFunction(function( seed, matches ) {
1098
			var j,
1099
				matchIndexes = fn( [], seed.length, argument ),
1100
				i = matchIndexes.length;
1101
1102
			// Match elements found at the specified indexes
1103
			while ( i-- ) {
1104
				if ( seed[ (j = matchIndexes[i]) ] ) {
1105
					seed[j] = !(matches[j] = seed[j]);
1106
				}
1107
			}
1108
		});
1109
	});
1110
}
1111
1112
/**
1113
 * Checks a node for validity as a Sizzle context
1114
 * @param {Element|Object=} context
1115
 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1116
 */
1117
function testContext( context ) {
1118
	return context && typeof context.getElementsByTagName !== "undefined" && context;
1119
}
1120
1121
// Expose support vars for convenience
1122
support = Sizzle.support = {};
1123
1124
/**
1125
 * Detects XML nodes
1126
 * @param {Element|Object} elem An element or a document
1127
 * @returns {Boolean} True iff elem is a non-HTML XML node
1128
 */
1129
isXML = Sizzle.isXML = function( elem ) {
1130
	// documentElement is verified for cases where it doesn't yet exist
1131
	// (such as loading iframes in IE - #4833)
1132
	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1133
	return documentElement ? documentElement.nodeName !== "HTML" : false;
1134
};
1135
1136
/**
1137
 * Sets document-related variables once based on the current document
1138
 * @param {Element|Object} [doc] An element or document object to use to set the document
1139
 * @returns {Object} Returns the current document
1140
 */
1141
setDocument = Sizzle.setDocument = function( node ) {
1142
	var hasCompare, subWindow,
1143
		doc = node ? node.ownerDocument || node : preferredDoc;
1144
1145
	// Return early if doc is invalid or already selected
1146
	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1147
		return document;
1148
	}
1149
1150
	// Update global variables
1151
	document = doc;
1152
	docElem = document.documentElement;
1153
	documentIsHTML = !isXML( document );
1154
1155
	// Support: IE 9-11, Edge
1156
	// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1157
	if ( preferredDoc !== document &&
1158
		(subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1159
1160
		// Support: IE 11, Edge
1161
		if ( subWindow.addEventListener ) {
1162
			subWindow.addEventListener( "unload", unloadHandler, false );
1163
1164
		// Support: IE 9 - 10 only
1165
		} else if ( subWindow.attachEvent ) {
1166
			subWindow.attachEvent( "onunload", unloadHandler );
1167
		}
1168
	}
1169
1170
	/* Attributes
1171
	---------------------------------------------------------------------- */
1172
1173
	// Support: IE<8
1174
	// Verify that getAttribute really returns attributes and not properties
1175
	// (excepting IE8 booleans)
1176
	support.attributes = assert(function( el ) {
1177
		el.className = "i";
1178
		return !el.getAttribute("className");
1179
	});
1180
1181
	/* getElement(s)By*
1182
	---------------------------------------------------------------------- */
1183
1184
	// Check if getElementsByTagName("*") returns only elements
1185
	support.getElementsByTagName = assert(function( el ) {
1186
		el.appendChild( document.createComment("") );
1187
		return !el.getElementsByTagName("*").length;
1188
	});
1189
1190
	// Support: IE<9
1191
	support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1192
1193
	// Support: IE<10
1194
	// Check if getElementById returns elements by name
1195
	// The broken getElementById methods don't pick up programmatically-set names,
1196
	// so use a roundabout getElementsByName test
1197
	support.getById = assert(function( el ) {
1198
		docElem.appendChild( el ).id = expando;
1199
		return !document.getElementsByName || !document.getElementsByName( expando ).length;
1200
	});
1201
1202
	// ID filter and find
1203
	if ( support.getById ) {
1204
		Expr.filter["ID"] = function( id ) {
1205
			var attrId = id.replace( runescape, funescape );
1206
			return function( elem ) {
1207
				return elem.getAttribute("id") === attrId;
1208
			};
1209
		};
1210
		Expr.find["ID"] = function( id, context ) {
1211
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1212
				var elem = context.getElementById( id );
1213
				return elem ? [ elem ] : [];
1214
			}
1215
		};
1216
	} else {
1217
		Expr.filter["ID"] =  function( id ) {
1218
			var attrId = id.replace( runescape, funescape );
1219
			return function( elem ) {
1220
				var node = typeof elem.getAttributeNode !== "undefined" &&
1221
					elem.getAttributeNode("id");
1222
				return node && node.value === attrId;
1223
			};
1224
		};
1225
1226
		// Support: IE 6 - 7 only
1227
		// getElementById is not reliable as a find shortcut
1228
		Expr.find["ID"] = function( id, context ) {
1229
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1230
				var node, i, elems,
1231
					elem = context.getElementById( id );
1232
1233
				if ( elem ) {
1234
1235
					// Verify the id attribute
1236
					node = elem.getAttributeNode("id");
1237
					if ( node && node.value === id ) {
1238
						return [ elem ];
1239
					}
1240
1241
					// Fall back on getElementsByName
1242
					elems = context.getElementsByName( id );
1243
					i = 0;
1244
					while ( (elem = elems[i++]) ) {
1245
						node = elem.getAttributeNode("id");
1246
						if ( node && node.value === id ) {
1247
							return [ elem ];
1248
						}
1249
					}
1250
				}
1251
1252
				return [];
1253
			}
1254
		};
1255
	}
1256
1257
	// Tag
1258
	Expr.find["TAG"] = support.getElementsByTagName ?
1259
		function( tag, context ) {
1260
			if ( typeof context.getElementsByTagName !== "undefined" ) {
1261
				return context.getElementsByTagName( tag );
1262
1263
			// DocumentFragment nodes don't have gEBTN
1264
			} else if ( support.qsa ) {
1265
				return context.querySelectorAll( tag );
1266
			}
1267
		} :
1268
1269
		function( tag, context ) {
1270
			var elem,
1271
				tmp = [],
1272
				i = 0,
1273
				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1274
				results = context.getElementsByTagName( tag );
1275
1276
			// Filter out possible comments
1277
			if ( tag === "*" ) {
1278
				while ( (elem = results[i++]) ) {
1279
					if ( elem.nodeType === 1 ) {
1280
						tmp.push( elem );
1281
					}
1282
				}
1283
1284
				return tmp;
1285
			}
1286
			return results;
1287
		};
1288
1289
	// Class
1290
	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1291
		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1292
			return context.getElementsByClassName( className );
1293
		}
1294
	};
1295
1296
	/* QSA/matchesSelector
1297
	---------------------------------------------------------------------- */
1298
1299
	// QSA and matchesSelector support
1300
1301
	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1302
	rbuggyMatches = [];
1303
1304
	// qSa(:focus) reports false when true (Chrome 21)
1305
	// We allow this because of a bug in IE8/9 that throws an error
1306
	// whenever `document.activeElement` is accessed on an iframe
1307
	// So, we allow :focus to pass through QSA all the time to avoid the IE error
1308
	// See https://bugs.jquery.com/ticket/13378
1309
	rbuggyQSA = [];
1310
1311
	if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1312
		// Build QSA regex
1313
		// Regex strategy adopted from Diego Perini
1314
		assert(function( el ) {
1315
			// Select is set to empty string on purpose
1316
			// This is to test IE's treatment of not explicitly
1317
			// setting a boolean content attribute,
1318
			// since its presence should be enough
1319
			// https://bugs.jquery.com/ticket/12359
1320
			docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1321
				"<select id='" + expando + "-\r\\' msallowcapture=''>" +
1322
				"<option selected=''></option></select>";
1323
1324
			// Support: IE8, Opera 11-12.16
1325
			// Nothing should be selected when empty strings follow ^= or $= or *=
1326
			// The test attribute must be unknown in Opera but "safe" for WinRT
1327
			// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1328
			if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1329
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1330
			}
1331
1332
			// Support: IE8
1333
			// Boolean attributes and "value" are not treated correctly
1334
			if ( !el.querySelectorAll("[selected]").length ) {
1335
				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1336
			}
1337
1338
			// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1339
			if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1340
				rbuggyQSA.push("~=");
1341
			}
1342
1343
			// Webkit/Opera - :checked should return selected option elements
1344
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1345
			// IE8 throws error here and will not see later tests
1346
			if ( !el.querySelectorAll(":checked").length ) {
1347
				rbuggyQSA.push(":checked");
1348
			}
1349
1350
			// Support: Safari 8+, iOS 8+
1351
			// https://bugs.webkit.org/show_bug.cgi?id=136851
1352
			// In-page `selector#id sibling-combinator selector` fails
1353
			if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1354
				rbuggyQSA.push(".#.+[+~]");
1355
			}
1356
		});
1357
1358
		assert(function( el ) {
1359
			el.innerHTML = "<a href='' disabled='disabled'></a>" +
1360
				"<select disabled='disabled'><option/></select>";
1361
1362
			// Support: Windows 8 Native Apps
1363
			// The type and name attributes are restricted during .innerHTML assignment
1364
			var input = document.createElement("input");
1365
			input.setAttribute( "type", "hidden" );
1366
			el.appendChild( input ).setAttribute( "name", "D" );
1367
1368
			// Support: IE8
1369
			// Enforce case-sensitivity of name attribute
1370
			if ( el.querySelectorAll("[name=d]").length ) {
1371
				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1372
			}
1373
1374
			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1375
			// IE8 throws error here and will not see later tests
1376
			if ( el.querySelectorAll(":enabled").length !== 2 ) {
1377
				rbuggyQSA.push( ":enabled", ":disabled" );
1378
			}
1379
1380
			// Support: IE9-11+
1381
			// IE's :disabled selector does not pick up the children of disabled fieldsets
1382
			docElem.appendChild( el ).disabled = true;
1383
			if ( el.querySelectorAll(":disabled").length !== 2 ) {
1384
				rbuggyQSA.push( ":enabled", ":disabled" );
1385
			}
1386
1387
			// Opera 10-11 does not throw on post-comma invalid pseudos
1388
			el.querySelectorAll("*,:x");
1389
			rbuggyQSA.push(",.*:");
1390
		});
1391
	}
1392
1393
	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1394
		docElem.webkitMatchesSelector ||
1395
		docElem.mozMatchesSelector ||
1396
		docElem.oMatchesSelector ||
1397
		docElem.msMatchesSelector) )) ) {
1398
1399
		assert(function( el ) {
1400
			// Check to see if it's possible to do matchesSelector
1401
			// on a disconnected node (IE 9)
1402
			support.disconnectedMatch = matches.call( el, "*" );
1403
1404
			// This should fail with an exception
1405
			// Gecko does not error, returns false instead
1406
			matches.call( el, "[s!='']:x" );
1407
			rbuggyMatches.push( "!=", pseudos );
1408
		});
1409
	}
1410
1411
	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1412
	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1413
1414
	/* Contains
1415
	---------------------------------------------------------------------- */
1416
	hasCompare = rnative.test( docElem.compareDocumentPosition );
1417
1418
	// Element contains another
1419
	// Purposefully self-exclusive
1420
	// As in, an element does not contain itself
1421
	contains = hasCompare || rnative.test( docElem.contains ) ?
1422
		function( a, b ) {
1423
			var adown = a.nodeType === 9 ? a.documentElement : a,
1424
				bup = b && b.parentNode;
1425
			return a === bup || !!( bup && bup.nodeType === 1 && (
1426
				adown.contains ?
1427
					adown.contains( bup ) :
1428
					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1429
			));
1430
		} :
1431
		function( a, b ) {
1432
			if ( b ) {
1433
				while ( (b = b.parentNode) ) {
1434
					if ( b === a ) {
1435
						return true;
1436
					}
1437
				}
1438
			}
1439
			return false;
1440
		};
1441
1442
	/* Sorting
1443
	---------------------------------------------------------------------- */
1444
1445
	// Document order sorting
1446
	sortOrder = hasCompare ?
1447
	function( a, b ) {
1448
1449
		// Flag for duplicate removal
1450
		if ( a === b ) {
1451
			hasDuplicate = true;
1452
			return 0;
1453
		}
1454
1455
		// Sort on method existence if only one input has compareDocumentPosition
1456
		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1457
		if ( compare ) {
1458
			return compare;
1459
		}
1460
1461
		// Calculate position if both inputs belong to the same document
1462
		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1463
			a.compareDocumentPosition( b ) :
1464
1465
			// Otherwise we know they are disconnected
1466
			1;
1467
1468
		// Disconnected nodes
1469
		if ( compare & 1 ||
1470
			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1471
1472
			// Choose the first element that is related to our preferred document
1473
			if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1474
				return -1;
1475
			}
1476
			if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1477
				return 1;
1478
			}
1479
1480
			// Maintain original order
1481
			return sortInput ?
1482
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1483
				0;
1484
		}
1485
1486
		return compare & 4 ? -1 : 1;
1487
	} :
1488
	function( a, b ) {
1489
		// Exit early if the nodes are identical
1490
		if ( a === b ) {
1491
			hasDuplicate = true;
1492
			return 0;
1493
		}
1494
1495
		var cur,
1496
			i = 0,
1497
			aup = a.parentNode,
1498
			bup = b.parentNode,
1499
			ap = [ a ],
1500
			bp = [ b ];
1501
1502
		// Parentless nodes are either documents or disconnected
1503
		if ( !aup || !bup ) {
1504
			return a === document ? -1 :
1505
				b === document ? 1 :
1506
				aup ? -1 :
1507
				bup ? 1 :
1508
				sortInput ?
1509
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1510
				0;
1511
1512
		// If the nodes are siblings, we can do a quick check
1513
		} else if ( aup === bup ) {
1514
			return siblingCheck( a, b );
1515
		}
1516
1517
		// Otherwise we need full lists of their ancestors for comparison
1518
		cur = a;
1519
		while ( (cur = cur.parentNode) ) {
1520
			ap.unshift( cur );
1521
		}
1522
		cur = b;
1523
		while ( (cur = cur.parentNode) ) {
1524
			bp.unshift( cur );
1525
		}
1526
1527
		// Walk down the tree looking for a discrepancy
1528
		while ( ap[i] === bp[i] ) {
1529
			i++;
1530
		}
1531
1532
		return i ?
1533
			// Do a sibling check if the nodes have a common ancestor
1534
			siblingCheck( ap[i], bp[i] ) :
1535
1536
			// Otherwise nodes in our document sort first
1537
			ap[i] === preferredDoc ? -1 :
1538
			bp[i] === preferredDoc ? 1 :
1539
			0;
1540
	};
1541
1542
	return document;
1543
};
1544
1545
Sizzle.matches = function( expr, elements ) {
1546
	return Sizzle( expr, null, null, elements );
1547
};
1548
1549
Sizzle.matchesSelector = function( elem, expr ) {
1550
	// Set document vars if needed
1551
	if ( ( elem.ownerDocument || elem ) !== document ) {
1552
		setDocument( elem );
1553
	}
1554
1555
	// Make sure that attribute selectors are quoted
1556
	expr = expr.replace( rattributeQuotes, "='$1']" );
1557
1558
	if ( support.matchesSelector && documentIsHTML &&
1559
		!compilerCache[ expr + " " ] &&
1560
		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1561
		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1562
1563
		try {
1564
			var ret = matches.call( elem, expr );
1565
1566
			// IE 9's matchesSelector returns false on disconnected nodes
1567
			if ( ret || support.disconnectedMatch ||
1568
					// As well, disconnected nodes are said to be in a document
1569
					// fragment in IE 9
1570
					elem.document && elem.document.nodeType !== 11 ) {
1571
				return ret;
1572
			}
1573
		} catch (e) {}
1574
	}
1575
1576
	return Sizzle( expr, document, null, [ elem ] ).length > 0;
1577
};
1578
1579
Sizzle.contains = function( context, elem ) {
1580
	// Set document vars if needed
1581
	if ( ( context.ownerDocument || context ) !== document ) {
1582
		setDocument( context );
1583
	}
1584
	return contains( context, elem );
1585
};
1586
1587
Sizzle.attr = function( elem, name ) {
1588
	// Set document vars if needed
1589
	if ( ( elem.ownerDocument || elem ) !== document ) {
1590
		setDocument( elem );
1591
	}
1592
1593
	var fn = Expr.attrHandle[ name.toLowerCase() ],
1594
		// Don't get fooled by Object.prototype properties (jQuery #13807)
1595
		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1596
			fn( elem, name, !documentIsHTML ) :
1597
			undefined;
1598
1599
	return val !== undefined ?
1600
		val :
1601
		support.attributes || !documentIsHTML ?
1602
			elem.getAttribute( name ) :
1603
			(val = elem.getAttributeNode(name)) && val.specified ?
1604
				val.value :
1605
				null;
1606
};
1607
1608
Sizzle.escape = function( sel ) {
1609
	return (sel + "").replace( rcssescape, fcssescape );
1610
};
1611
1612
Sizzle.error = function( msg ) {
1613
	throw new Error( "Syntax error, unrecognized expression: " + msg );
1614
};
1615
1616
/**
1617
 * Document sorting and removing duplicates
1618
 * @param {ArrayLike} results
1619
 */
1620
Sizzle.uniqueSort = function( results ) {
1621
	var elem,
1622
		duplicates = [],
1623
		j = 0,
1624
		i = 0;
1625
1626
	// Unless we *know* we can detect duplicates, assume their presence
1627
	hasDuplicate = !support.detectDuplicates;
1628
	sortInput = !support.sortStable && results.slice( 0 );
1629
	results.sort( sortOrder );
1630
1631
	if ( hasDuplicate ) {
1632
		while ( (elem = results[i++]) ) {
1633
			if ( elem === results[ i ] ) {
1634
				j = duplicates.push( i );
1635
			}
1636
		}
1637
		while ( j-- ) {
1638
			results.splice( duplicates[ j ], 1 );
1639
		}
1640
	}
1641
1642
	// Clear input after sorting to release objects
1643
	// See https://github.com/jquery/sizzle/pull/225
1644
	sortInput = null;
1645
1646
	return results;
1647
};
1648
1649
/**
1650
 * Utility function for retrieving the text value of an array of DOM nodes
1651
 * @param {Array|Element} elem
1652
 */
1653
getText = Sizzle.getText = function( elem ) {
1654
	var node,
1655
		ret = "",
1656
		i = 0,
1657
		nodeType = elem.nodeType;
1658
1659
	if ( !nodeType ) {
1660
		// If no nodeType, this is expected to be an array
1661
		while ( (node = elem[i++]) ) {
1662
			// Do not traverse comment nodes
1663
			ret += getText( node );
1664
		}
1665
	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1666
		// Use textContent for elements
1667
		// innerText usage removed for consistency of new lines (jQuery #11153)
1668
		if ( typeof elem.textContent === "string" ) {
1669
			return elem.textContent;
1670
		} else {
1671
			// Traverse its children
1672
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1673
				ret += getText( elem );
1674
			}
1675
		}
1676
	} else if ( nodeType === 3 || nodeType === 4 ) {
1677
		return elem.nodeValue;
1678
	}
1679
	// Do not include comment or processing instruction nodes
1680
1681
	return ret;
1682
};
1683
1684
Expr = Sizzle.selectors = {
1685
1686
	// Can be adjusted by the user
1687
	cacheLength: 50,
1688
1689
	createPseudo: markFunction,
1690
1691
	match: matchExpr,
1692
1693
	attrHandle: {},
1694
1695
	find: {},
1696
1697
	relative: {
1698
		">": { dir: "parentNode", first: true },
1699
		" ": { dir: "parentNode" },
1700
		"+": { dir: "previousSibling", first: true },
1701
		"~": { dir: "previousSibling" }
1702
	},
1703
1704
	preFilter: {
1705
		"ATTR": function( match ) {
1706
			match[1] = match[1].replace( runescape, funescape );
1707
1708
			// Move the given value to match[3] whether quoted or unquoted
1709
			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1710
1711
			if ( match[2] === "~=" ) {
1712
				match[3] = " " + match[3] + " ";
1713
			}
1714
1715
			return match.slice( 0, 4 );
1716
		},
1717
1718
		"CHILD": function( match ) {
1719
			/* matches from matchExpr["CHILD"]
1720
				1 type (only|nth|...)
1721
				2 what (child|of-type)
1722
				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1723
				4 xn-component of xn+y argument ([+-]?\d*n|)
1724
				5 sign of xn-component
1725
				6 x of xn-component
1726
				7 sign of y-component
1727
				8 y of y-component
1728
			*/
1729
			match[1] = match[1].toLowerCase();
1730
1731
			if ( match[1].slice( 0, 3 ) === "nth" ) {
1732
				// nth-* requires argument
1733
				if ( !match[3] ) {
1734
					Sizzle.error( match[0] );
1735
				}
1736
1737
				// numeric x and y parameters for Expr.filter.CHILD
1738
				// remember that false/true cast respectively to 0/1
1739
				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1740
				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1741
1742
			// other types prohibit arguments
1743
			} else if ( match[3] ) {
1744
				Sizzle.error( match[0] );
1745
			}
1746
1747
			return match;
1748
		},
1749
1750
		"PSEUDO": function( match ) {
1751
			var excess,
1752
				unquoted = !match[6] && match[2];
1753
1754
			if ( matchExpr["CHILD"].test( match[0] ) ) {
1755
				return null;
1756
			}
1757
1758
			// Accept quoted arguments as-is
1759
			if ( match[3] ) {
1760
				match[2] = match[4] || match[5] || "";
1761
1762
			// Strip excess characters from unquoted arguments
1763
			} else if ( unquoted && rpseudo.test( unquoted ) &&
1764
				// Get excess from tokenize (recursively)
1765
				(excess = tokenize( unquoted, true )) &&
1766
				// advance to the next closing parenthesis
1767
				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1768
1769
				// excess is a negative index
1770
				match[0] = match[0].slice( 0, excess );
1771
				match[2] = unquoted.slice( 0, excess );
1772
			}
1773
1774
			// Return only captures needed by the pseudo filter method (type and argument)
1775
			return match.slice( 0, 3 );
1776
		}
1777
	},
1778
1779
	filter: {
1780
1781
		"TAG": function( nodeNameSelector ) {
1782
			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1783
			return nodeNameSelector === "*" ?
1784
				function() { return true; } :
1785
				function( elem ) {
1786
					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1787
				};
1788
		},
1789
1790
		"CLASS": function( className ) {
1791
			var pattern = classCache[ className + " " ];
1792
1793
			return pattern ||
1794
				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1795
				classCache( className, function( elem ) {
1796
					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1797
				});
1798
		},
1799
1800
		"ATTR": function( name, operator, check ) {
1801
			return function( elem ) {
1802
				var result = Sizzle.attr( elem, name );
1803
1804
				if ( result == null ) {
1805
					return operator === "!=";
1806
				}
1807
				if ( !operator ) {
1808
					return true;
1809
				}
1810
1811
				result += "";
1812
1813
				return operator === "=" ? result === check :
1814
					operator === "!=" ? result !== check :
1815
					operator === "^=" ? check && result.indexOf( check ) === 0 :
1816
					operator === "*=" ? check && result.indexOf( check ) > -1 :
1817
					operator === "$=" ? check && result.slice( -check.length ) === check :
1818
					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1819
					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1820
					false;
1821
			};
1822
		},
1823
1824
		"CHILD": function( type, what, argument, first, last ) {
1825
			var simple = type.slice( 0, 3 ) !== "nth",
1826
				forward = type.slice( -4 ) !== "last",
1827
				ofType = what === "of-type";
1828
1829
			return first === 1 && last === 0 ?
1830
1831
				// Shortcut for :nth-*(n)
1832
				function( elem ) {
1833
					return !!elem.parentNode;
1834
				} :
1835
1836
				function( elem, context, xml ) {
1837
					var cache, uniqueCache, outerCache, node, nodeIndex, start,
1838
						dir = simple !== forward ? "nextSibling" : "previousSibling",
1839
						parent = elem.parentNode,
1840
						name = ofType && elem.nodeName.toLowerCase(),
1841
						useCache = !xml && !ofType,
1842
						diff = false;
1843
1844
					if ( parent ) {
1845
1846
						// :(first|last|only)-(child|of-type)
1847
						if ( simple ) {
1848
							while ( dir ) {
1849
								node = elem;
1850
								while ( (node = node[ dir ]) ) {
1851
									if ( ofType ?
1852
										node.nodeName.toLowerCase() === name :
1853
										node.nodeType === 1 ) {
1854
1855
										return false;
1856
									}
1857
								}
1858
								// Reverse direction for :only-* (if we haven't yet done so)
1859
								start = dir = type === "only" && !start && "nextSibling";
1860
							}
1861
							return true;
1862
						}
1863
1864
						start = [ forward ? parent.firstChild : parent.lastChild ];
1865
1866
						// non-xml :nth-child(...) stores cache data on `parent`
1867
						if ( forward && useCache ) {
1868
1869
							// Seek `elem` from a previously-cached index
1870
1871
							// ...in a gzip-friendly way
1872
							node = parent;
1873
							outerCache = node[ expando ] || (node[ expando ] = {});
1874
1875
							// Support: IE <9 only
1876
							// Defend against cloned attroperties (jQuery gh-1709)
1877
							uniqueCache = outerCache[ node.uniqueID ] ||
1878
								(outerCache[ node.uniqueID ] = {});
1879
1880
							cache = uniqueCache[ type ] || [];
1881
							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1882
							diff = nodeIndex && cache[ 2 ];
1883
							node = nodeIndex && parent.childNodes[ nodeIndex ];
1884
1885
							while ( (node = ++nodeIndex && node && node[ dir ] ||
1886
1887
								// Fallback to seeking `elem` from the start
1888
								(diff = nodeIndex = 0) || start.pop()) ) {
1889
1890
								// When found, cache indexes on `parent` and break
1891
								if ( node.nodeType === 1 && ++diff && node === elem ) {
1892
									uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1893
									break;
1894
								}
1895
							}
1896
1897
						} else {
1898
							// Use previously-cached element index if available
1899
							if ( useCache ) {
1900
								// ...in a gzip-friendly way
1901
								node = elem;
1902
								outerCache = node[ expando ] || (node[ expando ] = {});
1903
1904
								// Support: IE <9 only
1905
								// Defend against cloned attroperties (jQuery gh-1709)
1906
								uniqueCache = outerCache[ node.uniqueID ] ||
1907
									(outerCache[ node.uniqueID ] = {});
1908
1909
								cache = uniqueCache[ type ] || [];
1910
								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1911
								diff = nodeIndex;
1912
							}
1913
1914
							// xml :nth-child(...)
1915
							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
1916
							if ( diff === false ) {
1917
								// Use the same loop as above to seek `elem` from the start
1918
								while ( (node = ++nodeIndex && node && node[ dir ] ||
1919
									(diff = nodeIndex = 0) || start.pop()) ) {
1920
1921
									if ( ( ofType ?
1922
										node.nodeName.toLowerCase() === name :
1923
										node.nodeType === 1 ) &&
1924
										++diff ) {
1925
1926
										// Cache the index of each encountered element
1927
										if ( useCache ) {
1928
											outerCache = node[ expando ] || (node[ expando ] = {});
1929
1930
											// Support: IE <9 only
1931
											// Defend against cloned attroperties (jQuery gh-1709)
1932
											uniqueCache = outerCache[ node.uniqueID ] ||
1933
												(outerCache[ node.uniqueID ] = {});
1934
1935
											uniqueCache[ type ] = [ dirruns, diff ];
1936
										}
1937
1938
										if ( node === elem ) {
1939
											break;
1940
										}
1941
									}
1942
								}
1943
							}
1944
						}
1945
1946
						// Incorporate the offset, then check against cycle size
1947
						diff -= last;
1948
						return diff === first || ( diff % first === 0 && diff / first >= 0 );
1949
					}
1950
				};
1951
		},
1952
1953
		"PSEUDO": function( pseudo, argument ) {
1954
			// pseudo-class names are case-insensitive
1955
			// http://www.w3.org/TR/selectors/#pseudo-classes
1956
			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1957
			// Remember that setFilters inherits from pseudos
1958
			var args,
1959
				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1960
					Sizzle.error( "unsupported pseudo: " + pseudo );
1961
1962
			// The user may use createPseudo to indicate that
1963
			// arguments are needed to create the filter function
1964
			// just as Sizzle does
1965
			if ( fn[ expando ] ) {
1966
				return fn( argument );
1967
			}
1968
1969
			// But maintain support for old signatures
1970
			if ( fn.length > 1 ) {
1971
				args = [ pseudo, pseudo, "", argument ];
1972
				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1973
					markFunction(function( seed, matches ) {
1974
						var idx,
1975
							matched = fn( seed, argument ),
1976
							i = matched.length;
1977
						while ( i-- ) {
1978
							idx = indexOf( seed, matched[i] );
1979
							seed[ idx ] = !( matches[ idx ] = matched[i] );
1980
						}
1981
					}) :
1982
					function( elem ) {
1983
						return fn( elem, 0, args );
1984
					};
1985
			}
1986
1987
			return fn;
1988
		}
1989
	},
1990
1991
	pseudos: {
1992
		// Potentially complex pseudos
1993
		"not": markFunction(function( selector ) {
1994
			// Trim the selector passed to compile
1995
			// to avoid treating leading and trailing
1996
			// spaces as combinators
1997
			var input = [],
1998
				results = [],
1999
				matcher = compile( selector.replace( rtrim, "$1" ) );
2000
2001
			return matcher[ expando ] ?
2002
				markFunction(function( seed, matches, context, xml ) {
2003
					var elem,
2004
						unmatched = matcher( seed, null, xml, [] ),
2005
						i = seed.length;
2006
2007
					// Match elements unmatched by `matcher`
2008
					while ( i-- ) {
2009
						if ( (elem = unmatched[i]) ) {
2010
							seed[i] = !(matches[i] = elem);
2011
						}
2012
					}
2013
				}) :
2014
				function( elem, context, xml ) {
2015
					input[0] = elem;
2016
					matcher( input, null, xml, results );
2017
					// Don't keep the element (issue #299)
2018
					input[0] = null;
2019
					return !results.pop();
2020
				};
2021
		}),
2022
2023
		"has": markFunction(function( selector ) {
2024
			return function( elem ) {
2025
				return Sizzle( selector, elem ).length > 0;
2026
			};
2027
		}),
2028
2029
		"contains": markFunction(function( text ) {
2030
			text = text.replace( runescape, funescape );
2031
			return function( elem ) {
2032
				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
2033
			};
2034
		}),
2035
2036
		// "Whether an element is represented by a :lang() selector
2037
		// is based solely on the element's language value
2038
		// being equal to the identifier C,
2039
		// or beginning with the identifier C immediately followed by "-".
2040
		// The matching of C against the element's language value is performed case-insensitively.
2041
		// The identifier C does not have to be a valid language name."
2042
		// http://www.w3.org/TR/selectors/#lang-pseudo
2043
		"lang": markFunction( function( lang ) {
2044
			// lang value must be a valid identifier
2045
			if ( !ridentifier.test(lang || "") ) {
2046
				Sizzle.error( "unsupported lang: " + lang );
2047
			}
2048
			lang = lang.replace( runescape, funescape ).toLowerCase();
2049
			return function( elem ) {
2050
				var elemLang;
2051
				do {
2052
					if ( (elemLang = documentIsHTML ?
2053
						elem.lang :
2054
						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2055
2056
						elemLang = elemLang.toLowerCase();
2057
						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2058
					}
2059
				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2060
				return false;
2061
			};
2062
		}),
2063
2064
		// Miscellaneous
2065
		"target": function( elem ) {
2066
			var hash = window.location && window.location.hash;
2067
			return hash && hash.slice( 1 ) === elem.id;
2068
		},
2069
2070
		"root": function( elem ) {
2071
			return elem === docElem;
2072
		},
2073
2074
		"focus": function( elem ) {
2075
			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2076
		},
2077
2078
		// Boolean properties
2079
		"enabled": createDisabledPseudo( false ),
2080
		"disabled": createDisabledPseudo( true ),
2081
2082
		"checked": function( elem ) {
2083
			// In CSS3, :checked should return both checked and selected elements
2084
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2085
			var nodeName = elem.nodeName.toLowerCase();
2086
			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2087
		},
2088
2089
		"selected": function( elem ) {
2090
			// Accessing this property makes selected-by-default
2091
			// options in Safari work properly
2092
			if ( elem.parentNode ) {
2093
				elem.parentNode.selectedIndex;
2094
			}
2095
2096
			return elem.selected === true;
2097
		},
2098
2099
		// Contents
2100
		"empty": function( elem ) {
2101
			// http://www.w3.org/TR/selectors/#empty-pseudo
2102
			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2103
			//   but not by others (comment: 8; processing instruction: 7; etc.)
2104
			// nodeType < 6 works because attributes (2) do not appear as children
2105
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2106
				if ( elem.nodeType < 6 ) {
2107
					return false;
2108
				}
2109
			}
2110
			return true;
2111
		},
2112
2113
		"parent": function( elem ) {
2114
			return !Expr.pseudos["empty"]( elem );
2115
		},
2116
2117
		// Element/input types
2118
		"header": function( elem ) {
2119
			return rheader.test( elem.nodeName );
2120
		},
2121
2122
		"input": function( elem ) {
2123
			return rinputs.test( elem.nodeName );
2124
		},
2125
2126
		"button": function( elem ) {
2127
			var name = elem.nodeName.toLowerCase();
2128
			return name === "input" && elem.type === "button" || name === "button";
2129
		},
2130
2131
		"text": function( elem ) {
2132
			var attr;
2133
			return elem.nodeName.toLowerCase() === "input" &&
2134
				elem.type === "text" &&
2135
2136
				// Support: IE<8
2137
				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2138
				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2139
		},
2140
2141
		// Position-in-collection
2142
		"first": createPositionalPseudo(function() {
2143
			return [ 0 ];
2144
		}),
2145
2146
		"last": createPositionalPseudo(function( matchIndexes, length ) {
2147
			return [ length - 1 ];
2148
		}),
2149
2150
		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2151
			return [ argument < 0 ? argument + length : argument ];
2152
		}),
2153
2154
		"even": createPositionalPseudo(function( matchIndexes, length ) {
2155
			var i = 0;
2156
			for ( ; i < length; i += 2 ) {
2157
				matchIndexes.push( i );
2158
			}
2159
			return matchIndexes;
2160
		}),
2161
2162
		"odd": createPositionalPseudo(function( matchIndexes, length ) {
2163
			var i = 1;
2164
			for ( ; i < length; i += 2 ) {
2165
				matchIndexes.push( i );
2166
			}
2167
			return matchIndexes;
2168
		}),
2169
2170
		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2171
			var i = argument < 0 ? argument + length : argument;
2172
			for ( ; --i >= 0; ) {
2173
				matchIndexes.push( i );
2174
			}
2175
			return matchIndexes;
2176
		}),
2177
2178
		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2179
			var i = argument < 0 ? argument + length : argument;
2180
			for ( ; ++i < length; ) {
2181
				matchIndexes.push( i );
2182
			}
2183
			return matchIndexes;
2184
		})
2185
	}
2186
};
2187
2188
Expr.pseudos["nth"] = Expr.pseudos["eq"];
2189
2190
// Add button/input type pseudos
2191
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2192
	Expr.pseudos[ i ] = createInputPseudo( i );
2193
}
2194
for ( i in { submit: true, reset: true } ) {
2195
	Expr.pseudos[ i ] = createButtonPseudo( i );
2196
}
2197
2198
// Easy API for creating new setFilters
2199
function setFilters() {}
2200
setFilters.prototype = Expr.filters = Expr.pseudos;
2201
Expr.setFilters = new setFilters();
2202
2203
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2204
	var matched, match, tokens, type,
2205
		soFar, groups, preFilters,
2206
		cached = tokenCache[ selector + " " ];
2207
2208
	if ( cached ) {
2209
		return parseOnly ? 0 : cached.slice( 0 );
2210
	}
2211
2212
	soFar = selector;
2213
	groups = [];
2214
	preFilters = Expr.preFilter;
2215
2216
	while ( soFar ) {
2217
2218
		// Comma and first run
2219
		if ( !matched || (match = rcomma.exec( soFar )) ) {
2220
			if ( match ) {
2221
				// Don't consume trailing commas as valid
2222
				soFar = soFar.slice( match[0].length ) || soFar;
2223
			}
2224
			groups.push( (tokens = []) );
2225
		}
2226
2227
		matched = false;
2228
2229
		// Combinators
2230
		if ( (match = rcombinators.exec( soFar )) ) {
2231
			matched = match.shift();
2232
			tokens.push({
2233
				value: matched,
2234
				// Cast descendant combinators to space
2235
				type: match[0].replace( rtrim, " " )
2236
			});
2237
			soFar = soFar.slice( matched.length );
2238
		}
2239
2240
		// Filters
2241
		for ( type in Expr.filter ) {
2242
			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2243
				(match = preFilters[ type ]( match ))) ) {
2244
				matched = match.shift();
2245
				tokens.push({
2246
					value: matched,
2247
					type: type,
2248
					matches: match
2249
				});
2250
				soFar = soFar.slice( matched.length );
2251
			}
2252
		}
2253
2254
		if ( !matched ) {
2255
			break;
2256
		}
2257
	}
2258
2259
	// Return the length of the invalid excess
2260
	// if we're just parsing
2261
	// Otherwise, throw an error or return tokens
2262
	return parseOnly ?
2263
		soFar.length :
2264
		soFar ?
2265
			Sizzle.error( selector ) :
2266
			// Cache the tokens
2267
			tokenCache( selector, groups ).slice( 0 );
2268
};
2269
2270
function toSelector( tokens ) {
2271
	var i = 0,
2272
		len = tokens.length,
2273
		selector = "";
2274
	for ( ; i < len; i++ ) {
2275
		selector += tokens[i].value;
2276
	}
2277
	return selector;
2278
}
2279
2280
function addCombinator( matcher, combinator, base ) {
2281
	var dir = combinator.dir,
2282
		skip = combinator.next,
2283
		key = skip || dir,
2284
		checkNonElements = base && key === "parentNode",
2285
		doneName = done++;
2286
2287
	return combinator.first ?
2288
		// Check against closest ancestor/preceding element
2289
		function( elem, context, xml ) {
2290
			while ( (elem = elem[ dir ]) ) {
2291
				if ( elem.nodeType === 1 || checkNonElements ) {
2292
					return matcher( elem, context, xml );
2293
				}
2294
			}
2295
			return false;
2296
		} :
2297
2298
		// Check against all ancestor/preceding elements
2299
		function( elem, context, xml ) {
2300
			var oldCache, uniqueCache, outerCache,
2301
				newCache = [ dirruns, doneName ];
2302
2303
			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2304
			if ( xml ) {
2305
				while ( (elem = elem[ dir ]) ) {
2306
					if ( elem.nodeType === 1 || checkNonElements ) {
2307
						if ( matcher( elem, context, xml ) ) {
2308
							return true;
2309
						}
2310
					}
2311
				}
2312
			} else {
2313
				while ( (elem = elem[ dir ]) ) {
2314
					if ( elem.nodeType === 1 || checkNonElements ) {
2315
						outerCache = elem[ expando ] || (elem[ expando ] = {});
2316
2317
						// Support: IE <9 only
2318
						// Defend against cloned attroperties (jQuery gh-1709)
2319
						uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2320
2321
						if ( skip && skip === elem.nodeName.toLowerCase() ) {
2322
							elem = elem[ dir ] || elem;
2323
						} else if ( (oldCache = uniqueCache[ key ]) &&
2324
							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2325
2326
							// Assign to newCache so results back-propagate to previous elements
2327
							return (newCache[ 2 ] = oldCache[ 2 ]);
2328
						} else {
2329
							// Reuse newcache so results back-propagate to previous elements
2330
							uniqueCache[ key ] = newCache;
2331
2332
							// A match means we're done; a fail means we have to keep checking
2333
							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2334
								return true;
2335
							}
2336
						}
2337
					}
2338
				}
2339
			}
2340
			return false;
2341
		};
2342
}
2343
2344
function elementMatcher( matchers ) {
2345
	return matchers.length > 1 ?
2346
		function( elem, context, xml ) {
2347
			var i = matchers.length;
2348
			while ( i-- ) {
2349
				if ( !matchers[i]( elem, context, xml ) ) {
2350
					return false;
2351
				}
2352
			}
2353
			return true;
2354
		} :
2355
		matchers[0];
2356
}
2357
2358
function multipleContexts( selector, contexts, results ) {
2359
	var i = 0,
2360
		len = contexts.length;
2361
	for ( ; i < len; i++ ) {
2362
		Sizzle( selector, contexts[i], results );
2363
	}
2364
	return results;
2365
}
2366
2367
function condense( unmatched, map, filter, context, xml ) {
2368
	var elem,
2369
		newUnmatched = [],
2370
		i = 0,
2371
		len = unmatched.length,
2372
		mapped = map != null;
2373
2374
	for ( ; i < len; i++ ) {
2375
		if ( (elem = unmatched[i]) ) {
2376
			if ( !filter || filter( elem, context, xml ) ) {
2377
				newUnmatched.push( elem );
2378
				if ( mapped ) {
2379
					map.push( i );
2380
				}
2381
			}
2382
		}
2383
	}
2384
2385
	return newUnmatched;
2386
}
2387
2388
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2389
	if ( postFilter && !postFilter[ expando ] ) {
2390
		postFilter = setMatcher( postFilter );
2391
	}
2392
	if ( postFinder && !postFinder[ expando ] ) {
2393
		postFinder = setMatcher( postFinder, postSelector );
2394
	}
2395
	return markFunction(function( seed, results, context, xml ) {
2396
		var temp, i, elem,
2397
			preMap = [],
2398
			postMap = [],
2399
			preexisting = results.length,
2400
2401
			// Get initial elements from seed or context
2402
			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2403
2404
			// Prefilter to get matcher input, preserving a map for seed-results synchronization
2405
			matcherIn = preFilter && ( seed || !selector ) ?
2406
				condense( elems, preMap, preFilter, context, xml ) :
2407
				elems,
2408
2409
			matcherOut = matcher ?
2410
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2411
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2412
2413
					// ...intermediate processing is necessary
2414
					[] :
2415
2416
					// ...otherwise use results directly
2417
					results :
2418
				matcherIn;
2419
2420
		// Find primary matches
2421
		if ( matcher ) {
2422
			matcher( matcherIn, matcherOut, context, xml );
2423
		}
2424
2425
		// Apply postFilter
2426
		if ( postFilter ) {
2427
			temp = condense( matcherOut, postMap );
2428
			postFilter( temp, [], context, xml );
2429
2430
			// Un-match failing elements by moving them back to matcherIn
2431
			i = temp.length;
2432
			while ( i-- ) {
2433
				if ( (elem = temp[i]) ) {
2434
					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2435
				}
2436
			}
2437
		}
2438
2439
		if ( seed ) {
2440
			if ( postFinder || preFilter ) {
2441
				if ( postFinder ) {
2442
					// Get the final matcherOut by condensing this intermediate into postFinder contexts
2443
					temp = [];
2444
					i = matcherOut.length;
2445
					while ( i-- ) {
2446
						if ( (elem = matcherOut[i]) ) {
2447
							// Restore matcherIn since elem is not yet a final match
2448
							temp.push( (matcherIn[i] = elem) );
2449
						}
2450
					}
2451
					postFinder( null, (matcherOut = []), temp, xml );
2452
				}
2453
2454
				// Move matched elements from seed to results to keep them synchronized
2455
				i = matcherOut.length;
2456
				while ( i-- ) {
2457
					if ( (elem = matcherOut[i]) &&
2458
						(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2459
2460
						seed[temp] = !(results[temp] = elem);
2461
					}
2462
				}
2463
			}
2464
2465
		// Add elements to results, through postFinder if defined
2466
		} else {
2467
			matcherOut = condense(
2468
				matcherOut === results ?
2469
					matcherOut.splice( preexisting, matcherOut.length ) :
2470
					matcherOut
2471
			);
2472
			if ( postFinder ) {
2473
				postFinder( null, results, matcherOut, xml );
2474
			} else {
2475
				push.apply( results, matcherOut );
2476
			}
2477
		}
2478
	});
2479
}
2480
2481
function matcherFromTokens( tokens ) {
2482
	var checkContext, matcher, j,
2483
		len = tokens.length,
2484
		leadingRelative = Expr.relative[ tokens[0].type ],
2485
		implicitRelative = leadingRelative || Expr.relative[" "],
2486
		i = leadingRelative ? 1 : 0,
2487
2488
		// The foundational matcher ensures that elements are reachable from top-level context(s)
2489
		matchContext = addCombinator( function( elem ) {
2490
			return elem === checkContext;
2491
		}, implicitRelative, true ),
2492
		matchAnyContext = addCombinator( function( elem ) {
2493
			return indexOf( checkContext, elem ) > -1;
2494
		}, implicitRelative, true ),
2495
		matchers = [ function( elem, context, xml ) {
2496
			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2497
				(checkContext = context).nodeType ?
2498
					matchContext( elem, context, xml ) :
2499
					matchAnyContext( elem, context, xml ) );
2500
			// Avoid hanging onto element (issue #299)
2501
			checkContext = null;
2502
			return ret;
2503
		} ];
2504
2505
	for ( ; i < len; i++ ) {
2506
		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2507
			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2508
		} else {
2509
			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2510
2511
			// Return special upon seeing a positional matcher
2512
			if ( matcher[ expando ] ) {
2513
				// Find the next relative operator (if any) for proper handling
2514
				j = ++i;
2515
				for ( ; j < len; j++ ) {
2516
					if ( Expr.relative[ tokens[j].type ] ) {
2517
						break;
2518
					}
2519
				}
2520
				return setMatcher(
2521
					i > 1 && elementMatcher( matchers ),
2522
					i > 1 && toSelector(
2523
						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
2524
						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2525
					).replace( rtrim, "$1" ),
2526
					matcher,
2527
					i < j && matcherFromTokens( tokens.slice( i, j ) ),
2528
					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2529
					j < len && toSelector( tokens )
2530
				);
2531
			}
2532
			matchers.push( matcher );
2533
		}
2534
	}
2535
2536
	return elementMatcher( matchers );
2537
}
2538
2539
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2540
	var bySet = setMatchers.length > 0,
2541
		byElement = elementMatchers.length > 0,
2542
		superMatcher = function( seed, context, xml, results, outermost ) {
2543
			var elem, j, matcher,
2544
				matchedCount = 0,
2545
				i = "0",
2546
				unmatched = seed && [],
2547
				setMatched = [],
2548
				contextBackup = outermostContext,
2549
				// We must always have either seed elements or outermost context
2550
				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2551
				// Use integer dirruns iff this is the outermost matcher
2552
				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2553
				len = elems.length;
2554
2555
			if ( outermost ) {
2556
				outermostContext = context === document || context || outermost;
2557
			}
2558
2559
			// Add elements passing elementMatchers directly to results
2560
			// Support: IE<9, Safari
2561
			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2562
			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2563
				if ( byElement && elem ) {
2564
					j = 0;
2565
					if ( !context && elem.ownerDocument !== document ) {
2566
						setDocument( elem );
2567
						xml = !documentIsHTML;
2568
					}
2569
					while ( (matcher = elementMatchers[j++]) ) {
2570
						if ( matcher( elem, context || document, xml) ) {
2571
							results.push( elem );
2572
							break;
2573
						}
2574
					}
2575
					if ( outermost ) {
2576
						dirruns = dirrunsUnique;
2577
					}
2578
				}
2579
2580
				// Track unmatched elements for set filters
2581
				if ( bySet ) {
2582
					// They will have gone through all possible matchers
2583
					if ( (elem = !matcher && elem) ) {
2584
						matchedCount--;
2585
					}
2586
2587
					// Lengthen the array for every element, matched or not
2588
					if ( seed ) {
2589
						unmatched.push( elem );
2590
					}
2591
				}
2592
			}
2593
2594
			// `i` is now the count of elements visited above, and adding it to `matchedCount`
2595
			// makes the latter nonnegative.
2596
			matchedCount += i;
2597
2598
			// Apply set filters to unmatched elements
2599
			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2600
			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2601
			// no element matchers and no seed.
2602
			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2603
			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
2604
			// numerically zero.
2605
			if ( bySet && i !== matchedCount ) {
2606
				j = 0;
2607
				while ( (matcher = setMatchers[j++]) ) {
2608
					matcher( unmatched, setMatched, context, xml );
2609
				}
2610
2611
				if ( seed ) {
2612
					// Reintegrate element matches to eliminate the need for sorting
2613
					if ( matchedCount > 0 ) {
2614
						while ( i-- ) {
2615
							if ( !(unmatched[i] || setMatched[i]) ) {
2616
								setMatched[i] = pop.call( results );
2617
							}
2618
						}
2619
					}
2620
2621
					// Discard index placeholder values to get only actual matches
2622
					setMatched = condense( setMatched );
2623
				}
2624
2625
				// Add matches to results
2626
				push.apply( results, setMatched );
2627
2628
				// Seedless set matches succeeding multiple successful matchers stipulate sorting
2629
				if ( outermost && !seed && setMatched.length > 0 &&
2630
					( matchedCount + setMatchers.length ) > 1 ) {
2631
2632
					Sizzle.uniqueSort( results );
2633
				}
2634
			}
2635
2636
			// Override manipulation of globals by nested matchers
2637
			if ( outermost ) {
2638
				dirruns = dirrunsUnique;
2639
				outermostContext = contextBackup;
2640
			}
2641
2642
			return unmatched;
2643
		};
2644
2645
	return bySet ?
2646
		markFunction( superMatcher ) :
2647
		superMatcher;
2648
}
2649
2650
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2651
	var i,
2652
		setMatchers = [],
2653
		elementMatchers = [],
2654
		cached = compilerCache[ selector + " " ];
2655
2656
	if ( !cached ) {
2657
		// Generate a function of recursive functions that can be used to check each element
2658
		if ( !match ) {
2659
			match = tokenize( selector );
2660
		}
2661
		i = match.length;
2662
		while ( i-- ) {
2663
			cached = matcherFromTokens( match[i] );
2664
			if ( cached[ expando ] ) {
2665
				setMatchers.push( cached );
2666
			} else {
2667
				elementMatchers.push( cached );
2668
			}
2669
		}
2670
2671
		// Cache the compiled function
2672
		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2673
2674
		// Save selector and tokenization
2675
		cached.selector = selector;
2676
	}
2677
	return cached;
2678
};
2679
2680
/**
2681
 * A low-level selection function that works with Sizzle's compiled
2682
 *  selector functions
2683
 * @param {String|Function} selector A selector or a pre-compiled
2684
 *  selector function built with Sizzle.compile
2685
 * @param {Element} context
2686
 * @param {Array} [results]
2687
 * @param {Array} [seed] A set of elements to match against
2688
 */
2689
select = Sizzle.select = function( selector, context, results, seed ) {
2690
	var i, tokens, token, type, find,
2691
		compiled = typeof selector === "function" && selector,
2692
		match = !seed && tokenize( (selector = compiled.selector || selector) );
2693
2694
	results = results || [];
2695
2696
	// Try to minimize operations if there is only one selector in the list and no seed
2697
	// (the latter of which guarantees us context)
2698
	if ( match.length === 1 ) {
2699
2700
		// Reduce context if the leading compound selector is an ID
2701
		tokens = match[0] = match[0].slice( 0 );
2702
		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2703
				context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
2704
2705
			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2706
			if ( !context ) {
2707
				return results;
2708
2709
			// Precompiled matchers will still verify ancestry, so step up a level
2710
			} else if ( compiled ) {
2711
				context = context.parentNode;
2712
			}
2713
2714
			selector = selector.slice( tokens.shift().value.length );
2715
		}
2716
2717
		// Fetch a seed set for right-to-left matching
2718
		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2719
		while ( i-- ) {
2720
			token = tokens[i];
2721
2722
			// Abort if we hit a combinator
2723
			if ( Expr.relative[ (type = token.type) ] ) {
2724
				break;
2725
			}
2726
			if ( (find = Expr.find[ type ]) ) {
2727
				// Search, expanding context for leading sibling combinators
2728
				if ( (seed = find(
2729
					token.matches[0].replace( runescape, funescape ),
2730
					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2731
				)) ) {
2732
2733
					// If seed is empty or no tokens remain, we can return early
2734
					tokens.splice( i, 1 );
2735
					selector = seed.length && toSelector( tokens );
2736
					if ( !selector ) {
2737
						push.apply( results, seed );
2738
						return results;
2739
					}
2740
2741
					break;
2742
				}
2743
			}
2744
		}
2745
	}
2746
2747
	// Compile and execute a filtering function if one is not provided
2748
	// Provide `match` to avoid retokenization if we modified the selector above
2749
	( compiled || compile( selector, match ) )(
2750
		seed,
2751
		context,
2752
		!documentIsHTML,
2753
		results,
2754
		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2755
	);
2756
	return results;
2757
};
2758
2759
// One-time assignments
2760
2761
// Sort stability
2762
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2763
2764
// Support: Chrome 14-35+
2765
// Always assume duplicates if they aren't passed to the comparison function
2766
support.detectDuplicates = !!hasDuplicate;
2767
2768
// Initialize against the default document
2769
setDocument();
2770
2771
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2772
// Detached nodes confoundingly follow *each other*
2773
support.sortDetached = assert(function( el ) {
2774
	// Should return 1, but returns 4 (following)
2775
	return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2776
});
2777
2778
// Support: IE<8
2779
// Prevent attribute/property "interpolation"
2780
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2781
if ( !assert(function( el ) {
2782
	el.innerHTML = "<a href='#'></a>";
2783
	return el.firstChild.getAttribute("href") === "#" ;
2784
}) ) {
2785
	addHandle( "type|href|height|width", function( elem, name, isXML ) {
2786
		if ( !isXML ) {
2787
			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2788
		}
2789
	});
2790
}
2791
2792
// Support: IE<9
2793
// Use defaultValue in place of getAttribute("value")
2794
if ( !support.attributes || !assert(function( el ) {
2795
	el.innerHTML = "<input/>";
2796
	el.firstChild.setAttribute( "value", "" );
2797
	return el.firstChild.getAttribute( "value" ) === "";
2798
}) ) {
2799
	addHandle( "value", function( elem, name, isXML ) {
2800
		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2801
			return elem.defaultValue;
2802
		}
2803
	});
2804
}
2805
2806
// Support: IE<9
2807
// Use getAttributeNode to fetch booleans when getAttribute lies
2808
if ( !assert(function( el ) {
2809
	return el.getAttribute("disabled") == null;
2810
}) ) {
2811
	addHandle( booleans, function( elem, name, isXML ) {
2812
		var val;
2813
		if ( !isXML ) {
2814
			return elem[ name ] === true ? name.toLowerCase() :
2815
					(val = elem.getAttributeNode( name )) && val.specified ?
2816
					val.value :
2817
				null;
2818
		}
2819
	});
2820
}
2821
2822
return Sizzle;
2823
2824
})( window );
2825
2826
2827
2828
jQuery.find = Sizzle;
2829
jQuery.expr = Sizzle.selectors;
2830
2831
// Deprecated
2832
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2833
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2834
jQuery.text = Sizzle.getText;
2835
jQuery.isXMLDoc = Sizzle.isXML;
2836
jQuery.contains = Sizzle.contains;
2837
jQuery.escapeSelector = Sizzle.escape;
2838
2839
2840
2841
2842
var dir = function( elem, dir, until ) {
2843
	var matched = [],
2844
		truncate = until !== undefined;
2845
2846
	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2847
		if ( elem.nodeType === 1 ) {
2848
			if ( truncate && jQuery( elem ).is( until ) ) {
2849
				break;
2850
			}
2851
			matched.push( elem );
2852
		}
2853
	}
2854
	return matched;
2855
};
2856
2857
2858
var siblings = function( n, elem ) {
2859
	var matched = [];
2860
2861
	for ( ; n; n = n.nextSibling ) {
2862
		if ( n.nodeType === 1 && n !== elem ) {
2863
			matched.push( n );
2864
		}
2865
	}
2866
2867
	return matched;
2868
};
2869
2870
2871
var rneedsContext = jQuery.expr.match.needsContext;
2872
2873
2874
2875
function nodeName( elem, name ) {
2876
2877
  return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2878
2879
};
2880
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2881
2882
2883
2884
// Implement the identical functionality for filter and not
2885
function winnow( elements, qualifier, not ) {
2886
	if ( isFunction( qualifier ) ) {
2887
		return jQuery.grep( elements, function( elem, i ) {
2888
			return !!qualifier.call( elem, i, elem ) !== not;
2889
		} );
2890
	}
2891
2892
	// Single element
2893
	if ( qualifier.nodeType ) {
2894
		return jQuery.grep( elements, function( elem ) {
2895
			return ( elem === qualifier ) !== not;
2896
		} );
2897
	}
2898
2899
	// Arraylike of elements (jQuery, arguments, Array)
2900
	if ( typeof qualifier !== "string" ) {
2901
		return jQuery.grep( elements, function( elem ) {
2902
			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2903
		} );
2904
	}
2905
2906
	// Filtered directly for both simple and complex selectors
2907
	return jQuery.filter( qualifier, elements, not );
2908
}
2909
2910
jQuery.filter = function( expr, elems, not ) {
2911
	var elem = elems[ 0 ];
2912
2913
	if ( not ) {
2914
		expr = ":not(" + expr + ")";
2915
	}
2916
2917
	if ( elems.length === 1 && elem.nodeType === 1 ) {
2918
		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2919
	}
2920
2921
	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2922
		return elem.nodeType === 1;
2923
	} ) );
2924
};
2925
2926
jQuery.fn.extend( {
2927
	find: function( selector ) {
2928
		var i, ret,
2929
			len = this.length,
2930
			self = this;
2931
2932
		if ( typeof selector !== "string" ) {
2933
			return this.pushStack( jQuery( selector ).filter( function() {
2934
				for ( i = 0; i < len; i++ ) {
2935
					if ( jQuery.contains( self[ i ], this ) ) {
2936
						return true;
2937
					}
2938
				}
2939
			} ) );
2940
		}
2941
2942
		ret = this.pushStack( [] );
2943
2944
		for ( i = 0; i < len; i++ ) {
2945
			jQuery.find( selector, self[ i ], ret );
2946
		}
2947
2948
		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2949
	},
2950
	filter: function( selector ) {
2951
		return this.pushStack( winnow( this, selector || [], false ) );
2952
	},
2953
	not: function( selector ) {
2954
		return this.pushStack( winnow( this, selector || [], true ) );
2955
	},
2956
	is: function( selector ) {
2957
		return !!winnow(
2958
			this,
2959
2960
			// If this is a positional/relative selector, check membership in the returned set
2961
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
2962
			typeof selector === "string" && rneedsContext.test( selector ) ?
2963
				jQuery( selector ) :
2964
				selector || [],
2965
			false
2966
		).length;
2967
	}
2968
} );
2969
2970
2971
// Initialize a jQuery object
2972
2973
2974
// A central reference to the root jQuery(document)
2975
var rootjQuery,
2976
2977
	// A simple way to check for HTML strings
2978
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2979
	// Strict HTML recognition (#11290: must start with <)
2980
	// Shortcut simple #id case for speed
2981
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2982
2983
	init = jQuery.fn.init = function( selector, context, root ) {
2984
		var match, elem;
2985
2986
		// HANDLE: $(""), $(null), $(undefined), $(false)
2987
		if ( !selector ) {
2988
			return this;
2989
		}
2990
2991
		// Method init() accepts an alternate rootjQuery
2992
		// so migrate can support jQuery.sub (gh-2101)
2993
		root = root || rootjQuery;
2994
2995
		// Handle HTML strings
2996
		if ( typeof selector === "string" ) {
2997
			if ( selector[ 0 ] === "<" &&
2998
				selector[ selector.length - 1 ] === ">" &&
2999
				selector.length >= 3 ) {
3000
3001
				// Assume that strings that start and end with <> are HTML and skip the regex check
3002
				match = [ null, selector, null ];
3003
3004
			} else {
3005
				match = rquickExpr.exec( selector );
3006
			}
3007
3008
			// Match html or make sure no context is specified for #id
3009
			if ( match && ( match[ 1 ] || !context ) ) {
3010
3011
				// HANDLE: $(html) -> $(array)
3012
				if ( match[ 1 ] ) {
3013
					context = context instanceof jQuery ? context[ 0 ] : context;
3014
3015
					// Option to run scripts is true for back-compat
3016
					// Intentionally let the error be thrown if parseHTML is not present
3017
					jQuery.merge( this, jQuery.parseHTML(
3018
						match[ 1 ],
3019
						context && context.nodeType ? context.ownerDocument || context : document,
3020
						true
3021
					) );
3022
3023
					// HANDLE: $(html, props)
3024
					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
3025
						for ( match in context ) {
3026
3027
							// Properties of context are called as methods if possible
3028
							if ( isFunction( this[ match ] ) ) {
3029
								this[ match ]( context[ match ] );
3030
3031
							// ...and otherwise set as attributes
3032
							} else {
3033
								this.attr( match, context[ match ] );
3034
							}
3035
						}
3036
					}
3037
3038
					return this;
3039
3040
				// HANDLE: $(#id)
3041
				} else {
3042
					elem = document.getElementById( match[ 2 ] );
3043
3044
					if ( elem ) {
3045
3046
						// Inject the element directly into the jQuery object
3047
						this[ 0 ] = elem;
3048
						this.length = 1;
3049
					}
3050
					return this;
3051
				}
3052
3053
			// HANDLE: $(expr, $(...))
3054
			} else if ( !context || context.jquery ) {
3055
				return ( context || root ).find( selector );
3056
3057
			// HANDLE: $(expr, context)
3058
			// (which is just equivalent to: $(context).find(expr)
3059
			} else {
3060
				return this.constructor( context ).find( selector );
3061
			}
3062
3063
		// HANDLE: $(DOMElement)
3064
		} else if ( selector.nodeType ) {
3065
			this[ 0 ] = selector;
3066
			this.length = 1;
3067
			return this;
3068
3069
		// HANDLE: $(function)
3070
		// Shortcut for document ready
3071
		} else if ( isFunction( selector ) ) {
3072
			return root.ready !== undefined ?
3073
				root.ready( selector ) :
3074
3075
				// Execute immediately if ready is not present
3076
				selector( jQuery );
3077
		}
3078
3079
		return jQuery.makeArray( selector, this );
3080
	};
3081
3082
// Give the init function the jQuery prototype for later instantiation
3083
init.prototype = jQuery.fn;
3084
3085
// Initialize central reference
3086
rootjQuery = jQuery( document );
3087
3088
3089
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3090
3091
	// Methods guaranteed to produce a unique set when starting from a unique set
3092
	guaranteedUnique = {
3093
		children: true,
3094
		contents: true,
3095
		next: true,
3096
		prev: true
3097
	};
3098
3099
jQuery.fn.extend( {
3100
	has: function( target ) {
3101
		var targets = jQuery( target, this ),
3102
			l = targets.length;
3103
3104
		return this.filter( function() {
3105
			var i = 0;
3106
			for ( ; i < l; i++ ) {
3107
				if ( jQuery.contains( this, targets[ i ] ) ) {
3108
					return true;
3109
				}
3110
			}
3111
		} );
3112
	},
3113
3114
	closest: function( selectors, context ) {
3115
		var cur,
3116
			i = 0,
3117
			l = this.length,
3118
			matched = [],
3119
			targets = typeof selectors !== "string" && jQuery( selectors );
3120
3121
		// Positional selectors never match, since there's no _selection_ context
3122
		if ( !rneedsContext.test( selectors ) ) {
3123
			for ( ; i < l; i++ ) {
3124
				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3125
3126
					// Always skip document fragments
3127
					if ( cur.nodeType < 11 && ( targets ?
3128
						targets.index( cur ) > -1 :
3129
3130
						// Don't pass non-elements to Sizzle
3131
						cur.nodeType === 1 &&
3132
							jQuery.find.matchesSelector( cur, selectors ) ) ) {
3133
3134
						matched.push( cur );
3135
						break;
3136
					}
3137
				}
3138
			}
3139
		}
3140
3141
		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3142
	},
3143
3144
	// Determine the position of an element within the set
3145
	index: function( elem ) {
3146
3147
		// No argument, return index in parent
3148
		if ( !elem ) {
3149
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3150
		}
3151
3152
		// Index in selector
3153
		if ( typeof elem === "string" ) {
3154
			return indexOf.call( jQuery( elem ), this[ 0 ] );
3155
		}
3156
3157
		// Locate the position of the desired element
3158
		return indexOf.call( this,
3159
3160
			// If it receives a jQuery object, the first element is used
3161
			elem.jquery ? elem[ 0 ] : elem
3162
		);
3163
	},
3164
3165
	add: function( selector, context ) {
3166
		return this.pushStack(
3167
			jQuery.uniqueSort(
3168
				jQuery.merge( this.get(), jQuery( selector, context ) )
3169
			)
3170
		);
3171
	},
3172
3173
	addBack: function( selector ) {
3174
		return this.add( selector == null ?
3175
			this.prevObject : this.prevObject.filter( selector )
3176
		);
3177
	}
3178
} );
3179
3180
function sibling( cur, dir ) {
3181
	while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3182
	return cur;
3183
}
3184
3185
jQuery.each( {
3186
	parent: function( elem ) {
3187
		var parent = elem.parentNode;
3188
		return parent && parent.nodeType !== 11 ? parent : null;
3189
	},
3190
	parents: function( elem ) {
3191
		return dir( elem, "parentNode" );
3192
	},
3193
	parentsUntil: function( elem, i, until ) {
3194
		return dir( elem, "parentNode", until );
3195
	},
3196
	next: function( elem ) {
3197
		return sibling( elem, "nextSibling" );
3198
	},
3199
	prev: function( elem ) {
3200
		return sibling( elem, "previousSibling" );
3201
	},
3202
	nextAll: function( elem ) {
3203
		return dir( elem, "nextSibling" );
3204
	},
3205
	prevAll: function( elem ) {
3206
		return dir( elem, "previousSibling" );
3207
	},
3208
	nextUntil: function( elem, i, until ) {
3209
		return dir( elem, "nextSibling", until );
3210
	},
3211
	prevUntil: function( elem, i, until ) {
3212
		return dir( elem, "previousSibling", until );
3213
	},
3214
	siblings: function( elem ) {
3215
		return siblings( ( elem.parentNode || {} ).firstChild, elem );
3216
	},
3217
	children: function( elem ) {
3218
		return siblings( elem.firstChild );
3219
	},
3220
	contents: function( elem ) {
3221
        if ( nodeName( elem, "iframe" ) ) {
3222
            return elem.contentDocument;
3223
        }
3224
3225
        // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3226
        // Treat the template element as a regular one in browsers that
3227
        // don't support it.
3228
        if ( nodeName( elem, "template" ) ) {
3229
            elem = elem.content || elem;
3230
        }
3231
3232
        return jQuery.merge( [], elem.childNodes );
3233
	}
3234
}, function( name, fn ) {
3235
	jQuery.fn[ name ] = function( until, selector ) {
3236
		var matched = jQuery.map( this, fn, until );
3237
3238
		if ( name.slice( -5 ) !== "Until" ) {
3239
			selector = until;
3240
		}
3241
3242
		if ( selector && typeof selector === "string" ) {
3243
			matched = jQuery.filter( selector, matched );
3244
		}
3245
3246
		if ( this.length > 1 ) {
3247
3248
			// Remove duplicates
3249
			if ( !guaranteedUnique[ name ] ) {
3250
				jQuery.uniqueSort( matched );
3251
			}
3252
3253
			// Reverse order for parents* and prev-derivatives
3254
			if ( rparentsprev.test( name ) ) {
3255
				matched.reverse();
3256
			}
3257
		}
3258
3259
		return this.pushStack( matched );
3260
	};
3261
} );
3262
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3263
3264
3265
3266
// Convert String-formatted options into Object-formatted ones
3267
function createOptions( options ) {
3268
	var object = {};
3269
	jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3270
		object[ flag ] = true;
3271
	} );
3272
	return object;
3273
}
3274
3275
/*
3276
 * Create a callback list using the following parameters:
3277
 *
3278
 *	options: an optional list of space-separated options that will change how
3279
 *			the callback list behaves or a more traditional option object
3280
 *
3281
 * By default a callback list will act like an event callback list and can be
3282
 * "fired" multiple times.
3283
 *
3284
 * Possible options:
3285
 *
3286
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
3287
 *
3288
 *	memory:			will keep track of previous values and will call any callback added
3289
 *					after the list has been fired right away with the latest "memorized"
3290
 *					values (like a Deferred)
3291
 *
3292
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
3293
 *
3294
 *	stopOnFalse:	interrupt callings when a callback returns false
3295
 *
3296
 */
3297
jQuery.Callbacks = function( options ) {
3298
3299
	// Convert options from String-formatted to Object-formatted if needed
3300
	// (we check in cache first)
3301
	options = typeof options === "string" ?
3302
		createOptions( options ) :
3303
		jQuery.extend( {}, options );
3304
3305
	var // Flag to know if list is currently firing
3306
		firing,
3307
3308
		// Last fire value for non-forgettable lists
3309
		memory,
3310
3311
		// Flag to know if list was already fired
3312
		fired,
3313
3314
		// Flag to prevent firing
3315
		locked,
3316
3317
		// Actual callback list
3318
		list = [],
3319
3320
		// Queue of execution data for repeatable lists
3321
		queue = [],
3322
3323
		// Index of currently firing callback (modified by add/remove as needed)
3324
		firingIndex = -1,
3325
3326
		// Fire callbacks
3327
		fire = function() {
3328
3329
			// Enforce single-firing
3330
			locked = locked || options.once;
3331
3332
			// Execute callbacks for all pending executions,
3333
			// respecting firingIndex overrides and runtime changes
3334
			fired = firing = true;
3335
			for ( ; queue.length; firingIndex = -1 ) {
3336
				memory = queue.shift();
3337
				while ( ++firingIndex < list.length ) {
3338
3339
					// Run callback and check for early termination
3340
					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3341
						options.stopOnFalse ) {
3342
3343
						// Jump to end and forget the data so .add doesn't re-fire
3344
						firingIndex = list.length;
3345
						memory = false;
3346
					}
3347
				}
3348
			}
3349
3350
			// Forget the data if we're done with it
3351
			if ( !options.memory ) {
3352
				memory = false;
3353
			}
3354
3355
			firing = false;
3356
3357
			// Clean up if we're done firing for good
3358
			if ( locked ) {
3359
3360
				// Keep an empty list if we have data for future add calls
3361
				if ( memory ) {
3362
					list = [];
3363
3364
				// Otherwise, this object is spent
3365
				} else {
3366
					list = "";
3367
				}
3368
			}
3369
		},
3370
3371
		// Actual Callbacks object
3372
		self = {
3373
3374
			// Add a callback or a collection of callbacks to the list
3375
			add: function() {
3376
				if ( list ) {
3377
3378
					// If we have memory from a past run, we should fire after adding
3379
					if ( memory && !firing ) {
3380
						firingIndex = list.length - 1;
3381
						queue.push( memory );
3382
					}
3383
3384
					( function add( args ) {
3385
						jQuery.each( args, function( _, arg ) {
3386
							if ( isFunction( arg ) ) {
3387
								if ( !options.unique || !self.has( arg ) ) {
3388
									list.push( arg );
3389
								}
3390
							} else if ( arg && arg.length && toType( arg ) !== "string" ) {
3391
3392
								// Inspect recursively
3393
								add( arg );
3394
							}
3395
						} );
3396
					} )( arguments );
3397
3398
					if ( memory && !firing ) {
3399
						fire();
3400
					}
3401
				}
3402
				return this;
3403
			},
3404
3405
			// Remove a callback from the list
3406
			remove: function() {
3407
				jQuery.each( arguments, function( _, arg ) {
3408
					var index;
3409
					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3410
						list.splice( index, 1 );
3411
3412
						// Handle firing indexes
3413
						if ( index <= firingIndex ) {
3414
							firingIndex--;
3415
						}
3416
					}
3417
				} );
3418
				return this;
3419
			},
3420
3421
			// Check if a given callback is in the list.
3422
			// If no argument is given, return whether or not list has callbacks attached.
3423
			has: function( fn ) {
3424
				return fn ?
3425
					jQuery.inArray( fn, list ) > -1 :
3426
					list.length > 0;
3427
			},
3428
3429
			// Remove all callbacks from the list
3430
			empty: function() {
3431
				if ( list ) {
3432
					list = [];
3433
				}
3434
				return this;
3435
			},
3436
3437
			// Disable .fire and .add
3438
			// Abort any current/pending executions
3439
			// Clear all callbacks and values
3440
			disable: function() {
3441
				locked = queue = [];
3442
				list = memory = "";
3443
				return this;
3444
			},
3445
			disabled: function() {
3446
				return !list;
3447
			},
3448
3449
			// Disable .fire
3450
			// Also disable .add unless we have memory (since it would have no effect)
3451
			// Abort any pending executions
3452
			lock: function() {
3453
				locked = queue = [];
3454
				if ( !memory && !firing ) {
3455
					list = memory = "";
3456
				}
3457
				return this;
3458
			},
3459
			locked: function() {
3460
				return !!locked;
3461
			},
3462
3463
			// Call all callbacks with the given context and arguments
3464
			fireWith: function( context, args ) {
3465
				if ( !locked ) {
3466
					args = args || [];
3467
					args = [ context, args.slice ? args.slice() : args ];
3468
					queue.push( args );
3469
					if ( !firing ) {
3470
						fire();
3471
					}
3472
				}
3473
				return this;
3474
			},
3475
3476
			// Call all the callbacks with the given arguments
3477
			fire: function() {
3478
				self.fireWith( this, arguments );
3479
				return this;
3480
			},
3481
3482
			// To know if the callbacks have already been called at least once
3483
			fired: function() {
3484
				return !!fired;
3485
			}
3486
		};
3487
3488
	return self;
3489
};
3490
3491
3492
function Identity( v ) {
3493
	return v;
3494
}
3495
function Thrower( ex ) {
3496
	throw ex;
3497
}
3498
3499
function adoptValue( value, resolve, reject, noValue ) {
3500
	var method;
3501
3502
	try {
3503
3504
		// Check for promise aspect first to privilege synchronous behavior
3505
		if ( value && isFunction( ( method = value.promise ) ) ) {
3506
			method.call( value ).done( resolve ).fail( reject );
3507
3508
		// Other thenables
3509
		} else if ( value && isFunction( ( method = value.then ) ) ) {
3510
			method.call( value, resolve, reject );
3511
3512
		// Other non-thenables
3513
		} else {
3514
3515
			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3516
			// * false: [ value ].slice( 0 ) => resolve( value )
3517
			// * true: [ value ].slice( 1 ) => resolve()
3518
			resolve.apply( undefined, [ value ].slice( noValue ) );
3519
		}
3520
3521
	// For Promises/A+, convert exceptions into rejections
3522
	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3523
	// Deferred#then to conditionally suppress rejection.
3524
	} catch ( value ) {
3525
3526
		// Support: Android 4.0 only
3527
		// Strict mode functions invoked without .call/.apply get global-object context
3528
		reject.apply( undefined, [ value ] );
3529
	}
3530
}
3531
3532
jQuery.extend( {
3533
3534
	Deferred: function( func ) {
3535
		var tuples = [
3536
3537
				// action, add listener, callbacks,
3538
				// ... .then handlers, argument index, [final state]
3539
				[ "notify", "progress", jQuery.Callbacks( "memory" ),
3540
					jQuery.Callbacks( "memory" ), 2 ],
3541
				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
3542
					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3543
				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
3544
					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3545
			],
3546
			state = "pending",
3547
			promise = {
3548
				state: function() {
3549
					return state;
3550
				},
3551
				always: function() {
3552
					deferred.done( arguments ).fail( arguments );
3553
					return this;
3554
				},
3555
				"catch": function( fn ) {
3556
					return promise.then( null, fn );
3557
				},
3558
3559
				// Keep pipe for back-compat
3560
				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3561
					var fns = arguments;
3562
3563
					return jQuery.Deferred( function( newDefer ) {
3564
						jQuery.each( tuples, function( i, tuple ) {
3565
3566
							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
3567
							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3568
3569
							// deferred.progress(function() { bind to newDefer or newDefer.notify })
3570
							// deferred.done(function() { bind to newDefer or newDefer.resolve })
3571
							// deferred.fail(function() { bind to newDefer or newDefer.reject })
3572
							deferred[ tuple[ 1 ] ]( function() {
3573
								var returned = fn && fn.apply( this, arguments );
3574
								if ( returned && isFunction( returned.promise ) ) {
3575
									returned.promise()
3576
										.progress( newDefer.notify )
3577
										.done( newDefer.resolve )
3578
										.fail( newDefer.reject );
3579
								} else {
3580
									newDefer[ tuple[ 0 ] + "With" ](
3581
										this,
3582
										fn ? [ returned ] : arguments
3583
									);
3584
								}
3585
							} );
3586
						} );
3587
						fns = null;
3588
					} ).promise();
3589
				},
3590
				then: function( onFulfilled, onRejected, onProgress ) {
3591
					var maxDepth = 0;
3592
					function resolve( depth, deferred, handler, special ) {
3593
						return function() {
3594
							var that = this,
3595
								args = arguments,
3596
								mightThrow = function() {
3597
									var returned, then;
3598
3599
									// Support: Promises/A+ section 2.3.3.3.3
3600
									// https://promisesaplus.com/#point-59
3601
									// Ignore double-resolution attempts
3602
									if ( depth < maxDepth ) {
3603
										return;
3604
									}
3605
3606
									returned = handler.apply( that, args );
3607
3608
									// Support: Promises/A+ section 2.3.1
3609
									// https://promisesaplus.com/#point-48
3610
									if ( returned === deferred.promise() ) {
3611
										throw new TypeError( "Thenable self-resolution" );
3612
									}
3613
3614
									// Support: Promises/A+ sections 2.3.3.1, 3.5
3615
									// https://promisesaplus.com/#point-54
3616
									// https://promisesaplus.com/#point-75
3617
									// Retrieve `then` only once
3618
									then = returned &&
3619
3620
										// Support: Promises/A+ section 2.3.4
3621
										// https://promisesaplus.com/#point-64
3622
										// Only check objects and functions for thenability
3623
										( typeof returned === "object" ||
3624
											typeof returned === "function" ) &&
3625
										returned.then;
3626
3627
									// Handle a returned thenable
3628
									if ( isFunction( then ) ) {
3629
3630
										// Special processors (notify) just wait for resolution
3631
										if ( special ) {
3632
											then.call(
3633
												returned,
3634
												resolve( maxDepth, deferred, Identity, special ),
3635
												resolve( maxDepth, deferred, Thrower, special )
3636
											);
3637
3638
										// Normal processors (resolve) also hook into progress
3639
										} else {
3640
3641
											// ...and disregard older resolution values
3642
											maxDepth++;
3643
3644
											then.call(
3645
												returned,
3646
												resolve( maxDepth, deferred, Identity, special ),
3647
												resolve( maxDepth, deferred, Thrower, special ),
3648
												resolve( maxDepth, deferred, Identity,
3649
													deferred.notifyWith )
3650
											);
3651
										}
3652
3653
									// Handle all other returned values
3654
									} else {
3655
3656
										// Only substitute handlers pass on context
3657
										// and multiple values (non-spec behavior)
3658
										if ( handler !== Identity ) {
3659
											that = undefined;
3660
											args = [ returned ];
3661
										}
3662
3663
										// Process the value(s)
3664
										// Default process is resolve
3665
										( special || deferred.resolveWith )( that, args );
3666
									}
3667
								},
3668
3669
								// Only normal processors (resolve) catch and reject exceptions
3670
								process = special ?
3671
									mightThrow :
3672
									function() {
3673
										try {
3674
											mightThrow();
3675
										} catch ( e ) {
3676
3677
											if ( jQuery.Deferred.exceptionHook ) {
3678
												jQuery.Deferred.exceptionHook( e,
3679
													process.stackTrace );
3680
											}
3681
3682
											// Support: Promises/A+ section 2.3.3.3.4.1
3683
											// https://promisesaplus.com/#point-61
3684
											// Ignore post-resolution exceptions
3685
											if ( depth + 1 >= maxDepth ) {
3686
3687
												// Only substitute handlers pass on context
3688
												// and multiple values (non-spec behavior)
3689
												if ( handler !== Thrower ) {
3690
													that = undefined;
3691
													args = [ e ];
3692
												}
3693
3694
												deferred.rejectWith( that, args );
3695
											}
3696
										}
3697
									};
3698
3699
							// Support: Promises/A+ section 2.3.3.3.1
3700
							// https://promisesaplus.com/#point-57
3701
							// Re-resolve promises immediately to dodge false rejection from
3702
							// subsequent errors
3703
							if ( depth ) {
3704
								process();
3705
							} else {
3706
3707
								// Call an optional hook to record the stack, in case of exception
3708
								// since it's otherwise lost when execution goes async
3709
								if ( jQuery.Deferred.getStackHook ) {
3710
									process.stackTrace = jQuery.Deferred.getStackHook();
3711
								}
3712
								window.setTimeout( process );
3713
							}
3714
						};
3715
					}
3716
3717
					return jQuery.Deferred( function( newDefer ) {
3718
3719
						// progress_handlers.add( ... )
3720
						tuples[ 0 ][ 3 ].add(
3721
							resolve(
3722
								0,
3723
								newDefer,
3724
								isFunction( onProgress ) ?
3725
									onProgress :
3726
									Identity,
3727
								newDefer.notifyWith
3728
							)
3729
						);
3730
3731
						// fulfilled_handlers.add( ... )
3732
						tuples[ 1 ][ 3 ].add(
3733
							resolve(
3734
								0,
3735
								newDefer,
3736
								isFunction( onFulfilled ) ?
3737
									onFulfilled :
3738
									Identity
3739
							)
3740
						);
3741
3742
						// rejected_handlers.add( ... )
3743
						tuples[ 2 ][ 3 ].add(
3744
							resolve(
3745
								0,
3746
								newDefer,
3747
								isFunction( onRejected ) ?
3748
									onRejected :
3749
									Thrower
3750
							)
3751
						);
3752
					} ).promise();
3753
				},
3754
3755
				// Get a promise for this deferred
3756
				// If obj is provided, the promise aspect is added to the object
3757
				promise: function( obj ) {
3758
					return obj != null ? jQuery.extend( obj, promise ) : promise;
3759
				}
3760
			},
3761
			deferred = {};
3762
3763
		// Add list-specific methods
3764
		jQuery.each( tuples, function( i, tuple ) {
3765
			var list = tuple[ 2 ],
3766
				stateString = tuple[ 5 ];
3767
3768
			// promise.progress = list.add
3769
			// promise.done = list.add
3770
			// promise.fail = list.add
3771
			promise[ tuple[ 1 ] ] = list.add;
3772
3773
			// Handle state
3774
			if ( stateString ) {
3775
				list.add(
3776
					function() {
3777
3778
						// state = "resolved" (i.e., fulfilled)
3779
						// state = "rejected"
3780
						state = stateString;
3781
					},
3782
3783
					// rejected_callbacks.disable
3784
					// fulfilled_callbacks.disable
3785
					tuples[ 3 - i ][ 2 ].disable,
3786
3787
					// rejected_handlers.disable
3788
					// fulfilled_handlers.disable
3789
					tuples[ 3 - i ][ 3 ].disable,
3790
3791
					// progress_callbacks.lock
3792
					tuples[ 0 ][ 2 ].lock,
3793
3794
					// progress_handlers.lock
3795
					tuples[ 0 ][ 3 ].lock
3796
				);
3797
			}
3798
3799
			// progress_handlers.fire
3800
			// fulfilled_handlers.fire
3801
			// rejected_handlers.fire
3802
			list.add( tuple[ 3 ].fire );
3803
3804
			// deferred.notify = function() { deferred.notifyWith(...) }
3805
			// deferred.resolve = function() { deferred.resolveWith(...) }
3806
			// deferred.reject = function() { deferred.rejectWith(...) }
3807
			deferred[ tuple[ 0 ] ] = function() {
3808
				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3809
				return this;
3810
			};
3811
3812
			// deferred.notifyWith = list.fireWith
3813
			// deferred.resolveWith = list.fireWith
3814
			// deferred.rejectWith = list.fireWith
3815
			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3816
		} );
3817
3818
		// Make the deferred a promise
3819
		promise.promise( deferred );
3820
3821
		// Call given func if any
3822
		if ( func ) {
3823
			func.call( deferred, deferred );
3824
		}
3825
3826
		// All done!
3827
		return deferred;
3828
	},
3829
3830
	// Deferred helper
3831
	when: function( singleValue ) {
3832
		var
3833
3834
			// count of uncompleted subordinates
3835
			remaining = arguments.length,
3836
3837
			// count of unprocessed arguments
3838
			i = remaining,
3839
3840
			// subordinate fulfillment data
3841
			resolveContexts = Array( i ),
3842
			resolveValues = slice.call( arguments ),
3843
3844
			// the master Deferred
3845
			master = jQuery.Deferred(),
3846
3847
			// subordinate callback factory
3848
			updateFunc = function( i ) {
3849
				return function( value ) {
3850
					resolveContexts[ i ] = this;
3851
					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3852
					if ( !( --remaining ) ) {
3853
						master.resolveWith( resolveContexts, resolveValues );
3854
					}
3855
				};
3856
			};
3857
3858
		// Single- and empty arguments are adopted like Promise.resolve
3859
		if ( remaining <= 1 ) {
3860
			adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3861
				!remaining );
3862
3863
			// Use .then() to unwrap secondary thenables (cf. gh-3000)
3864
			if ( master.state() === "pending" ||
3865
				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3866
3867
				return master.then();
3868
			}
3869
		}
3870
3871
		// Multiple arguments are aggregated like Promise.all array elements
3872
		while ( i-- ) {
3873
			adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3874
		}
3875
3876
		return master.promise();
3877
	}
3878
} );
3879
3880
3881
// These usually indicate a programmer mistake during development,
3882
// warn about them ASAP rather than swallowing them by default.
3883
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3884
3885
jQuery.Deferred.exceptionHook = function( error, stack ) {
3886
3887
	// Support: IE 8 - 9 only
3888
	// Console exists when dev tools are open, which can happen at any time
3889
	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3890
		window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3891
	}
3892
};
3893
3894
3895
3896
3897
jQuery.readyException = function( error ) {
3898
	window.setTimeout( function() {
3899
		throw error;
3900
	} );
3901
};
3902
3903
3904
3905
3906
// The deferred used on DOM ready
3907
var readyList = jQuery.Deferred();
3908
3909
jQuery.fn.ready = function( fn ) {
3910
3911
	readyList
3912
		.then( fn )
3913
3914
		// Wrap jQuery.readyException in a function so that the lookup
3915
		// happens at the time of error handling instead of callback
3916
		// registration.
3917
		.catch( function( error ) {
3918
			jQuery.readyException( error );
3919
		} );
3920
3921
	return this;
3922
};
3923
3924
jQuery.extend( {
3925
3926
	// Is the DOM ready to be used? Set to true once it occurs.
3927
	isReady: false,
3928
3929
	// A counter to track how many items to wait for before
3930
	// the ready event fires. See #6781
3931
	readyWait: 1,
3932
3933
	// Handle when the DOM is ready
3934
	ready: function( wait ) {
3935
3936
		// Abort if there are pending holds or we're already ready
3937
		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3938
			return;
3939
		}
3940
3941
		// Remember that the DOM is ready
3942
		jQuery.isReady = true;
3943
3944
		// If a normal DOM Ready event fired, decrement, and wait if need be
3945
		if ( wait !== true && --jQuery.readyWait > 0 ) {
3946
			return;
3947
		}
3948
3949
		// If there are functions bound, to execute
3950
		readyList.resolveWith( document, [ jQuery ] );
3951
	}
3952
} );
3953
3954
jQuery.ready.then = readyList.then;
3955
3956
// The ready event handler and self cleanup method
3957
function completed() {
3958
	document.removeEventListener( "DOMContentLoaded", completed );
3959
	window.removeEventListener( "load", completed );
3960
	jQuery.ready();
3961
}
3962
3963
// Catch cases where $(document).ready() is called
3964
// after the browser event has already occurred.
3965
// Support: IE <=9 - 10 only
3966
// Older IE sometimes signals "interactive" too soon
3967
if ( document.readyState === "complete" ||
3968
	( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3969
3970
	// Handle it asynchronously to allow scripts the opportunity to delay ready
3971
	window.setTimeout( jQuery.ready );
3972
3973
} else {
3974
3975
	// Use the handy event callback
3976
	document.addEventListener( "DOMContentLoaded", completed );
3977
3978
	// A fallback to window.onload, that will always work
3979
	window.addEventListener( "load", completed );
3980
}
3981
3982
3983
3984
3985
// Multifunctional method to get and set values of a collection
3986
// The value/s can optionally be executed if it's a function
3987
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3988
	var i = 0,
3989
		len = elems.length,
3990
		bulk = key == null;
3991
3992
	// Sets many values
3993
	if ( toType( key ) === "object" ) {
3994
		chainable = true;
3995
		for ( i in key ) {
3996
			access( elems, fn, i, key[ i ], true, emptyGet, raw );
3997
		}
3998
3999
	// Sets one value
4000
	} else if ( value !== undefined ) {
4001
		chainable = true;
4002
4003
		if ( !isFunction( value ) ) {
4004
			raw = true;
4005
		}
4006
4007
		if ( bulk ) {
4008
4009
			// Bulk operations run against the entire set
4010
			if ( raw ) {
4011
				fn.call( elems, value );
4012
				fn = null;
4013
4014
			// ...except when executing function values
4015
			} else {
4016
				bulk = fn;
4017
				fn = function( elem, key, value ) {
4018
					return bulk.call( jQuery( elem ), value );
4019
				};
4020
			}
4021
		}
4022
4023
		if ( fn ) {
4024
			for ( ; i < len; i++ ) {
4025
				fn(
4026
					elems[ i ], key, raw ?
4027
					value :
4028
					value.call( elems[ i ], i, fn( elems[ i ], key ) )
4029
				);
4030
			}
4031
		}
4032
	}
4033
4034
	if ( chainable ) {
4035
		return elems;
4036
	}
4037
4038
	// Gets
4039
	if ( bulk ) {
4040
		return fn.call( elems );
4041
	}
4042
4043
	return len ? fn( elems[ 0 ], key ) : emptyGet;
4044
};
4045
4046
4047
// Matches dashed string for camelizing
4048
var rmsPrefix = /^-ms-/,
4049
	rdashAlpha = /-([a-z])/g;
4050
4051
// Used by camelCase as callback to replace()
4052
function fcamelCase( all, letter ) {
4053
	return letter.toUpperCase();
4054
}
4055
4056
// Convert dashed to camelCase; used by the css and data modules
4057
// Support: IE <=9 - 11, Edge 12 - 15
4058
// Microsoft forgot to hump their vendor prefix (#9572)
4059
function camelCase( string ) {
4060
	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
4061
}
4062
var acceptData = function( owner ) {
4063
4064
	// Accepts only:
4065
	//  - Node
4066
	//    - Node.ELEMENT_NODE
4067
	//    - Node.DOCUMENT_NODE
4068
	//  - Object
4069
	//    - Any
4070
	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
4071
};
4072
4073
4074
4075
4076
function Data() {
4077
	this.expando = jQuery.expando + Data.uid++;
4078
}
4079
4080
Data.uid = 1;
4081
4082
Data.prototype = {
4083
4084
	cache: function( owner ) {
4085
4086
		// Check if the owner object already has a cache
4087
		var value = owner[ this.expando ];
4088
4089
		// If not, create one
4090
		if ( !value ) {
4091
			value = {};
4092
4093
			// We can accept data for non-element nodes in modern browsers,
4094
			// but we should not, see #8335.
4095
			// Always return an empty object.
4096
			if ( acceptData( owner ) ) {
4097
4098
				// If it is a node unlikely to be stringify-ed or looped over
4099
				// use plain assignment
4100
				if ( owner.nodeType ) {
4101
					owner[ this.expando ] = value;
4102
4103
				// Otherwise secure it in a non-enumerable property
4104
				// configurable must be true to allow the property to be
4105
				// deleted when data is removed
4106
				} else {
4107
					Object.defineProperty( owner, this.expando, {
4108
						value: value,
4109
						configurable: true
4110
					} );
4111
				}
4112
			}
4113
		}
4114
4115
		return value;
4116
	},
4117
	set: function( owner, data, value ) {
4118
		var prop,
4119
			cache = this.cache( owner );
4120
4121
		// Handle: [ owner, key, value ] args
4122
		// Always use camelCase key (gh-2257)
4123
		if ( typeof data === "string" ) {
4124
			cache[ camelCase( data ) ] = value;
4125
4126
		// Handle: [ owner, { properties } ] args
4127
		} else {
4128
4129
			// Copy the properties one-by-one to the cache object
4130
			for ( prop in data ) {
4131
				cache[ camelCase( prop ) ] = data[ prop ];
4132
			}
4133
		}
4134
		return cache;
4135
	},
4136
	get: function( owner, key ) {
4137
		return key === undefined ?
4138
			this.cache( owner ) :
4139
4140
			// Always use camelCase key (gh-2257)
4141
			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4142
	},
4143
	access: function( owner, key, value ) {
4144
4145
		// In cases where either:
4146
		//
4147
		//   1. No key was specified
4148
		//   2. A string key was specified, but no value provided
4149
		//
4150
		// Take the "read" path and allow the get method to determine
4151
		// which value to return, respectively either:
4152
		//
4153
		//   1. The entire cache object
4154
		//   2. The data stored at the key
4155
		//
4156
		if ( key === undefined ||
4157
				( ( key && typeof key === "string" ) && value === undefined ) ) {
4158
4159
			return this.get( owner, key );
4160
		}
4161
4162
		// When the key is not a string, or both a key and value
4163
		// are specified, set or extend (existing objects) with either:
4164
		//
4165
		//   1. An object of properties
4166
		//   2. A key and value
4167
		//
4168
		this.set( owner, key, value );
4169
4170
		// Since the "set" path can have two possible entry points
4171
		// return the expected data based on which path was taken[*]
4172
		return value !== undefined ? value : key;
4173
	},
4174
	remove: function( owner, key ) {
4175
		var i,
4176
			cache = owner[ this.expando ];
4177
4178
		if ( cache === undefined ) {
4179
			return;
4180
		}
4181
4182
		if ( key !== undefined ) {
4183
4184
			// Support array or space separated string of keys
4185
			if ( Array.isArray( key ) ) {
4186
4187
				// If key is an array of keys...
4188
				// We always set camelCase keys, so remove that.
4189
				key = key.map( camelCase );
4190
			} else {
4191
				key = camelCase( key );
4192
4193
				// If a key with the spaces exists, use it.
4194
				// Otherwise, create an array by matching non-whitespace
4195
				key = key in cache ?
4196
					[ key ] :
4197
					( key.match( rnothtmlwhite ) || [] );
4198
			}
4199
4200
			i = key.length;
4201
4202
			while ( i-- ) {
4203
				delete cache[ key[ i ] ];
4204
			}
4205
		}
4206
4207
		// Remove the expando if there's no more data
4208
		if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4209
4210
			// Support: Chrome <=35 - 45
4211
			// Webkit & Blink performance suffers when deleting properties
4212
			// from DOM nodes, so set to undefined instead
4213
			// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4214
			if ( owner.nodeType ) {
4215
				owner[ this.expando ] = undefined;
4216
			} else {
4217
				delete owner[ this.expando ];
4218
			}
4219
		}
4220
	},
4221
	hasData: function( owner ) {
4222
		var cache = owner[ this.expando ];
4223
		return cache !== undefined && !jQuery.isEmptyObject( cache );
4224
	}
4225
};
4226
var dataPriv = new Data();
4227
4228
var dataUser = new Data();
4229
4230
4231
4232
//	Implementation Summary
4233
//
4234
//	1. Enforce API surface and semantic compatibility with 1.9.x branch
4235
//	2. Improve the module's maintainability by reducing the storage
4236
//		paths to a single mechanism.
4237
//	3. Use the same single mechanism to support "private" and "user" data.
4238
//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4239
//	5. Avoid exposing implementation details on user objects (eg. expando properties)
4240
//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
4241
4242
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4243
	rmultiDash = /[A-Z]/g;
4244
4245
function getData( data ) {
4246
	if ( data === "true" ) {
4247
		return true;
4248
	}
4249
4250
	if ( data === "false" ) {
4251
		return false;
4252
	}
4253
4254
	if ( data === "null" ) {
4255
		return null;
4256
	}
4257
4258
	// Only convert to a number if it doesn't change the string
4259
	if ( data === +data + "" ) {
4260
		return +data;
4261
	}
4262
4263
	if ( rbrace.test( data ) ) {
4264
		return JSON.parse( data );
4265
	}
4266
4267
	return data;
4268
}
4269
4270
function dataAttr( elem, key, data ) {
4271
	var name;
4272
4273
	// If nothing was found internally, try to fetch any
4274
	// data from the HTML5 data-* attribute
4275
	if ( data === undefined && elem.nodeType === 1 ) {
4276
		name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4277
		data = elem.getAttribute( name );
4278
4279
		if ( typeof data === "string" ) {
4280
			try {
4281
				data = getData( data );
4282
			} catch ( e ) {}
4283
4284
			// Make sure we set the data so it isn't changed later
4285
			dataUser.set( elem, key, data );
4286
		} else {
4287
			data = undefined;
4288
		}
4289
	}
4290
	return data;
4291
}
4292
4293
jQuery.extend( {
4294
	hasData: function( elem ) {
4295
		return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4296
	},
4297
4298
	data: function( elem, name, data ) {
4299
		return dataUser.access( elem, name, data );
4300
	},
4301
4302
	removeData: function( elem, name ) {
4303
		dataUser.remove( elem, name );
4304
	},
4305
4306
	// TODO: Now that all calls to _data and _removeData have been replaced
4307
	// with direct calls to dataPriv methods, these can be deprecated.
4308
	_data: function( elem, name, data ) {
4309
		return dataPriv.access( elem, name, data );
4310
	},
4311
4312
	_removeData: function( elem, name ) {
4313
		dataPriv.remove( elem, name );
4314
	}
4315
} );
4316
4317
jQuery.fn.extend( {
4318
	data: function( key, value ) {
4319
		var i, name, data,
4320
			elem = this[ 0 ],
4321
			attrs = elem && elem.attributes;
4322
4323
		// Gets all values
4324
		if ( key === undefined ) {
4325
			if ( this.length ) {
4326
				data = dataUser.get( elem );
4327
4328
				if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4329
					i = attrs.length;
4330
					while ( i-- ) {
4331
4332
						// Support: IE 11 only
4333
						// The attrs elements can be null (#14894)
4334
						if ( attrs[ i ] ) {
4335
							name = attrs[ i ].name;
4336
							if ( name.indexOf( "data-" ) === 0 ) {
4337
								name = camelCase( name.slice( 5 ) );
4338
								dataAttr( elem, name, data[ name ] );
4339
							}
4340
						}
4341
					}
4342
					dataPriv.set( elem, "hasDataAttrs", true );
4343
				}
4344
			}
4345
4346
			return data;
4347
		}
4348
4349
		// Sets multiple values
4350
		if ( typeof key === "object" ) {
4351
			return this.each( function() {
4352
				dataUser.set( this, key );
4353
			} );
4354
		}
4355
4356
		return access( this, function( value ) {
4357
			var data;
4358
4359
			// The calling jQuery object (element matches) is not empty
4360
			// (and therefore has an element appears at this[ 0 ]) and the
4361
			// `value` parameter was not undefined. An empty jQuery object
4362
			// will result in `undefined` for elem = this[ 0 ] which will
4363
			// throw an exception if an attempt to read a data cache is made.
4364
			if ( elem && value === undefined ) {
4365
4366
				// Attempt to get data from the cache
4367
				// The key will always be camelCased in Data
4368
				data = dataUser.get( elem, key );
4369
				if ( data !== undefined ) {
4370
					return data;
4371
				}
4372
4373
				// Attempt to "discover" the data in
4374
				// HTML5 custom data-* attrs
4375
				data = dataAttr( elem, key );
4376
				if ( data !== undefined ) {
4377
					return data;
4378
				}
4379
4380
				// We tried really hard, but the data doesn't exist.
4381
				return;
4382
			}
4383
4384
			// Set the data...
4385
			this.each( function() {
4386
4387
				// We always store the camelCased key
4388
				dataUser.set( this, key, value );
4389
			} );
4390
		}, null, value, arguments.length > 1, null, true );
4391
	},
4392
4393
	removeData: function( key ) {
4394
		return this.each( function() {
4395
			dataUser.remove( this, key );
4396
		} );
4397
	}
4398
} );
4399
4400
4401
jQuery.extend( {
4402
	queue: function( elem, type, data ) {
4403
		var queue;
4404
4405
		if ( elem ) {
4406
			type = ( type || "fx" ) + "queue";
4407
			queue = dataPriv.get( elem, type );
4408
4409
			// Speed up dequeue by getting out quickly if this is just a lookup
4410
			if ( data ) {
4411
				if ( !queue || Array.isArray( data ) ) {
4412
					queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4413
				} else {
4414
					queue.push( data );
4415
				}
4416
			}
4417
			return queue || [];
4418
		}
4419
	},
4420
4421
	dequeue: function( elem, type ) {
4422
		type = type || "fx";
4423
4424
		var queue = jQuery.queue( elem, type ),
4425
			startLength = queue.length,
4426
			fn = queue.shift(),
4427
			hooks = jQuery._queueHooks( elem, type ),
4428
			next = function() {
4429
				jQuery.dequeue( elem, type );
4430
			};
4431
4432
		// If the fx queue is dequeued, always remove the progress sentinel
4433
		if ( fn === "inprogress" ) {
4434
			fn = queue.shift();
4435
			startLength--;
4436
		}
4437
4438
		if ( fn ) {
4439
4440
			// Add a progress sentinel to prevent the fx queue from being
4441
			// automatically dequeued
4442
			if ( type === "fx" ) {
4443
				queue.unshift( "inprogress" );
4444
			}
4445
4446
			// Clear up the last queue stop function
4447
			delete hooks.stop;
4448
			fn.call( elem, next, hooks );
4449
		}
4450
4451
		if ( !startLength && hooks ) {
4452
			hooks.empty.fire();
4453
		}
4454
	},
4455
4456
	// Not public - generate a queueHooks object, or return the current one
4457
	_queueHooks: function( elem, type ) {
4458
		var key = type + "queueHooks";
4459
		return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4460
			empty: jQuery.Callbacks( "once memory" ).add( function() {
4461
				dataPriv.remove( elem, [ type + "queue", key ] );
4462
			} )
4463
		} );
4464
	}
4465
} );
4466
4467
jQuery.fn.extend( {
4468
	queue: function( type, data ) {
4469
		var setter = 2;
4470
4471
		if ( typeof type !== "string" ) {
4472
			data = type;
4473
			type = "fx";
4474
			setter--;
4475
		}
4476
4477
		if ( arguments.length < setter ) {
4478
			return jQuery.queue( this[ 0 ], type );
4479
		}
4480
4481
		return data === undefined ?
4482
			this :
4483
			this.each( function() {
4484
				var queue = jQuery.queue( this, type, data );
4485
4486
				// Ensure a hooks for this queue
4487
				jQuery._queueHooks( this, type );
4488
4489
				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4490
					jQuery.dequeue( this, type );
4491
				}
4492
			} );
4493
	},
4494
	dequeue: function( type ) {
4495
		return this.each( function() {
4496
			jQuery.dequeue( this, type );
4497
		} );
4498
	},
4499
	clearQueue: function( type ) {
4500
		return this.queue( type || "fx", [] );
4501
	},
4502
4503
	// Get a promise resolved when queues of a certain type
4504
	// are emptied (fx is the type by default)
4505
	promise: function( type, obj ) {
4506
		var tmp,
4507
			count = 1,
4508
			defer = jQuery.Deferred(),
4509
			elements = this,
4510
			i = this.length,
4511
			resolve = function() {
4512
				if ( !( --count ) ) {
4513
					defer.resolveWith( elements, [ elements ] );
4514
				}
4515
			};
4516
4517
		if ( typeof type !== "string" ) {
4518
			obj = type;
4519
			type = undefined;
4520
		}
4521
		type = type || "fx";
4522
4523
		while ( i-- ) {
4524
			tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4525
			if ( tmp && tmp.empty ) {
4526
				count++;
4527
				tmp.empty.add( resolve );
4528
			}
4529
		}
4530
		resolve();
4531
		return defer.promise( obj );
4532
	}
4533
} );
4534
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4535
4536
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4537
4538
4539
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4540
4541
var isHiddenWithinTree = function( elem, el ) {
4542
4543
		// isHiddenWithinTree might be called from jQuery#filter function;
4544
		// in that case, element will be second argument
4545
		elem = el || elem;
4546
4547
		// Inline style trumps all
4548
		return elem.style.display === "none" ||
4549
			elem.style.display === "" &&
4550
4551
			// Otherwise, check computed style
4552
			// Support: Firefox <=43 - 45
4553
			// Disconnected elements can have computed display: none, so first confirm that elem is
4554
			// in the document.
4555
			jQuery.contains( elem.ownerDocument, elem ) &&
4556
4557
			jQuery.css( elem, "display" ) === "none";
4558
	};
4559
4560
var swap = function( elem, options, callback, args ) {
4561
	var ret, name,
4562
		old = {};
4563
4564
	// Remember the old values, and insert the new ones
4565
	for ( name in options ) {
4566
		old[ name ] = elem.style[ name ];
4567
		elem.style[ name ] = options[ name ];
4568
	}
4569
4570
	ret = callback.apply( elem, args || [] );
4571
4572
	// Revert the old values
4573
	for ( name in options ) {
4574
		elem.style[ name ] = old[ name ];
4575
	}
4576
4577
	return ret;
4578
};
4579
4580
4581
4582
4583
function adjustCSS( elem, prop, valueParts, tween ) {
4584
	var adjusted, scale,
4585
		maxIterations = 20,
4586
		currentValue = tween ?
4587
			function() {
4588
				return tween.cur();
4589
			} :
4590
			function() {
4591
				return jQuery.css( elem, prop, "" );
4592
			},
4593
		initial = currentValue(),
4594
		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4595
4596
		// Starting value computation is required for potential unit mismatches
4597
		initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4598
			rcssNum.exec( jQuery.css( elem, prop ) );
4599
4600
	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4601
4602
		// Support: Firefox <=54
4603
		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4604
		initial = initial / 2;
4605
4606
		// Trust units reported by jQuery.css
4607
		unit = unit || initialInUnit[ 3 ];
4608
4609
		// Iteratively approximate from a nonzero starting point
4610
		initialInUnit = +initial || 1;
4611
4612
		while ( maxIterations-- ) {
4613
4614
			// Evaluate and update our best guess (doubling guesses that zero out).
4615
			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4616
			jQuery.style( elem, prop, initialInUnit + unit );
4617
			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4618
				maxIterations = 0;
4619
			}
4620
			initialInUnit = initialInUnit / scale;
4621
4622
		}
4623
4624
		initialInUnit = initialInUnit * 2;
4625
		jQuery.style( elem, prop, initialInUnit + unit );
4626
4627
		// Make sure we update the tween properties later on
4628
		valueParts = valueParts || [];
4629
	}
4630
4631
	if ( valueParts ) {
4632
		initialInUnit = +initialInUnit || +initial || 0;
4633
4634
		// Apply relative offset (+=/-=) if specified
4635
		adjusted = valueParts[ 1 ] ?
4636
			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4637
			+valueParts[ 2 ];
4638
		if ( tween ) {
4639
			tween.unit = unit;
4640
			tween.start = initialInUnit;
4641
			tween.end = adjusted;
4642
		}
4643
	}
4644
	return adjusted;
4645
}
4646
4647
4648
var defaultDisplayMap = {};
4649
4650
function getDefaultDisplay( elem ) {
4651
	var temp,
4652
		doc = elem.ownerDocument,
4653
		nodeName = elem.nodeName,
4654
		display = defaultDisplayMap[ nodeName ];
4655
4656
	if ( display ) {
4657
		return display;
4658
	}
4659
4660
	temp = doc.body.appendChild( doc.createElement( nodeName ) );
4661
	display = jQuery.css( temp, "display" );
4662
4663
	temp.parentNode.removeChild( temp );
4664
4665
	if ( display === "none" ) {
4666
		display = "block";
4667
	}
4668
	defaultDisplayMap[ nodeName ] = display;
4669
4670
	return display;
4671
}
4672
4673
function showHide( elements, show ) {
4674
	var display, elem,
4675
		values = [],
4676
		index = 0,
4677
		length = elements.length;
4678
4679
	// Determine new display value for elements that need to change
4680
	for ( ; index < length; index++ ) {
4681
		elem = elements[ index ];
4682
		if ( !elem.style ) {
4683
			continue;
4684
		}
4685
4686
		display = elem.style.display;
4687
		if ( show ) {
4688
4689
			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4690
			// check is required in this first loop unless we have a nonempty display value (either
4691
			// inline or about-to-be-restored)
4692
			if ( display === "none" ) {
4693
				values[ index ] = dataPriv.get( elem, "display" ) || null;
4694
				if ( !values[ index ] ) {
4695
					elem.style.display = "";
4696
				}
4697
			}
4698
			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4699
				values[ index ] = getDefaultDisplay( elem );
4700
			}
4701
		} else {
4702
			if ( display !== "none" ) {
4703
				values[ index ] = "none";
4704
4705
				// Remember what we're overwriting
4706
				dataPriv.set( elem, "display", display );
4707
			}
4708
		}
4709
	}
4710
4711
	// Set the display of the elements in a second loop to avoid constant reflow
4712
	for ( index = 0; index < length; index++ ) {
4713
		if ( values[ index ] != null ) {
4714
			elements[ index ].style.display = values[ index ];
4715
		}
4716
	}
4717
4718
	return elements;
4719
}
4720
4721
jQuery.fn.extend( {
4722
	show: function() {
4723
		return showHide( this, true );
4724
	},
4725
	hide: function() {
4726
		return showHide( this );
4727
	},
4728
	toggle: function( state ) {
4729
		if ( typeof state === "boolean" ) {
4730
			return state ? this.show() : this.hide();
4731
		}
4732
4733
		return this.each( function() {
4734
			if ( isHiddenWithinTree( this ) ) {
4735
				jQuery( this ).show();
4736
			} else {
4737
				jQuery( this ).hide();
4738
			}
4739
		} );
4740
	}
4741
} );
4742
var rcheckableType = ( /^(?:checkbox|radio)$/i );
4743
4744
var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
4745
4746
var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4747
4748
4749
4750
// We have to close these tags to support XHTML (#13200)
4751
var wrapMap = {
4752
4753
	// Support: IE <=9 only
4754
	option: [ 1, "<select multiple='multiple'>", "</select>" ],
4755
4756
	// XHTML parsers do not magically insert elements in the
4757
	// same way that tag soup parsers do. So we cannot shorten
4758
	// this by omitting <tbody> or other required elements.
4759
	thead: [ 1, "<table>", "</table>" ],
4760
	col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4761
	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4762
	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4763
4764
	_default: [ 0, "", "" ]
4765
};
4766
4767
// Support: IE <=9 only
4768
wrapMap.optgroup = wrapMap.option;
4769
4770
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4771
wrapMap.th = wrapMap.td;
4772
4773
4774
function getAll( context, tag ) {
4775
4776
	// Support: IE <=9 - 11 only
4777
	// Use typeof to avoid zero-argument method invocation on host objects (#15151)
4778
	var ret;
4779
4780
	if ( typeof context.getElementsByTagName !== "undefined" ) {
4781
		ret = context.getElementsByTagName( tag || "*" );
4782
4783
	} else if ( typeof context.querySelectorAll !== "undefined" ) {
4784
		ret = context.querySelectorAll( tag || "*" );
4785
4786
	} else {
4787
		ret = [];
4788
	}
4789
4790
	if ( tag === undefined || tag && nodeName( context, tag ) ) {
4791
		return jQuery.merge( [ context ], ret );
4792
	}
4793
4794
	return ret;
4795
}
4796
4797
4798
// Mark scripts as having already been evaluated
4799
function setGlobalEval( elems, refElements ) {
4800
	var i = 0,
4801
		l = elems.length;
4802
4803
	for ( ; i < l; i++ ) {
4804
		dataPriv.set(
4805
			elems[ i ],
4806
			"globalEval",
4807
			!refElements || dataPriv.get( refElements[ i ], "globalEval" )
4808
		);
4809
	}
4810
}
4811
4812
4813
var rhtml = /<|&#?\w+;/;
4814
4815
function buildFragment( elems, context, scripts, selection, ignored ) {
4816
	var elem, tmp, tag, wrap, contains, j,
4817
		fragment = context.createDocumentFragment(),
4818
		nodes = [],
4819
		i = 0,
4820
		l = elems.length;
4821
4822
	for ( ; i < l; i++ ) {
4823
		elem = elems[ i ];
4824
4825
		if ( elem || elem === 0 ) {
4826
4827
			// Add nodes directly
4828
			if ( toType( elem ) === "object" ) {
4829
4830
				// Support: Android <=4.0 only, PhantomJS 1 only
4831
				// push.apply(_, arraylike) throws on ancient WebKit
4832
				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4833
4834
			// Convert non-html into a text node
4835
			} else if ( !rhtml.test( elem ) ) {
4836
				nodes.push( context.createTextNode( elem ) );
4837
4838
			// Convert html into DOM nodes
4839
			} else {
4840
				tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4841
4842
				// Deserialize a standard representation
4843
				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4844
				wrap = wrapMap[ tag ] || wrapMap._default;
4845
				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4846
4847
				// Descend through wrappers to the right content
4848
				j = wrap[ 0 ];
4849
				while ( j-- ) {
4850
					tmp = tmp.lastChild;
4851
				}
4852
4853
				// Support: Android <=4.0 only, PhantomJS 1 only
4854
				// push.apply(_, arraylike) throws on ancient WebKit
4855
				jQuery.merge( nodes, tmp.childNodes );
4856
4857
				// Remember the top-level container
4858
				tmp = fragment.firstChild;
4859
4860
				// Ensure the created nodes are orphaned (#12392)
4861
				tmp.textContent = "";
4862
			}
4863
		}
4864
	}
4865
4866
	// Remove wrapper from fragment
4867
	fragment.textContent = "";
4868
4869
	i = 0;
4870
	while ( ( elem = nodes[ i++ ] ) ) {
4871
4872
		// Skip elements already in the context collection (trac-4087)
4873
		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4874
			if ( ignored ) {
4875
				ignored.push( elem );
4876
			}
4877
			continue;
4878
		}
4879
4880
		contains = jQuery.contains( elem.ownerDocument, elem );
4881
4882
		// Append to fragment
4883
		tmp = getAll( fragment.appendChild( elem ), "script" );
4884
4885
		// Preserve script evaluation history
4886
		if ( contains ) {
4887
			setGlobalEval( tmp );
4888
		}
4889
4890
		// Capture executables
4891
		if ( scripts ) {
4892
			j = 0;
4893
			while ( ( elem = tmp[ j++ ] ) ) {
4894
				if ( rscriptType.test( elem.type || "" ) ) {
4895
					scripts.push( elem );
4896
				}
4897
			}
4898
		}
4899
	}
4900
4901
	return fragment;
4902
}
4903
4904
4905
( function() {
4906
	var fragment = document.createDocumentFragment(),
4907
		div = fragment.appendChild( document.createElement( "div" ) ),
4908
		input = document.createElement( "input" );
4909
4910
	// Support: Android 4.0 - 4.3 only
4911
	// Check state lost if the name is set (#11217)
4912
	// Support: Windows Web Apps (WWA)
4913
	// `name` and `type` must use .setAttribute for WWA (#14901)
4914
	input.setAttribute( "type", "radio" );
4915
	input.setAttribute( "checked", "checked" );
4916
	input.setAttribute( "name", "t" );
4917
4918
	div.appendChild( input );
4919
4920
	// Support: Android <=4.1 only
4921
	// Older WebKit doesn't clone checked state correctly in fragments
4922
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4923
4924
	// Support: IE <=11 only
4925
	// Make sure textarea (and checkbox) defaultValue is properly cloned
4926
	div.innerHTML = "<textarea>x</textarea>";
4927
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4928
} )();
4929
var documentElement = document.documentElement;
4930
4931
4932
4933
var
4934
	rkeyEvent = /^key/,
4935
	rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
4936
	rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4937
4938
function returnTrue() {
4939
	return true;
4940
}
4941
4942
function returnFalse() {
4943
	return false;
4944
}
4945
4946
// Support: IE <=9 only
4947
// See #13393 for more info
4948
function safeActiveElement() {
4949
	try {
4950
		return document.activeElement;
4951
	} catch ( err ) { }
4952
}
4953
4954
function on( elem, types, selector, data, fn, one ) {
4955
	var origFn, type;
4956
4957
	// Types can be a map of types/handlers
4958
	if ( typeof types === "object" ) {
4959
4960
		// ( types-Object, selector, data )
4961
		if ( typeof selector !== "string" ) {
4962
4963
			// ( types-Object, data )
4964
			data = data || selector;
4965
			selector = undefined;
4966
		}
4967
		for ( type in types ) {
4968
			on( elem, type, selector, data, types[ type ], one );
4969
		}
4970
		return elem;
4971
	}
4972
4973
	if ( data == null && fn == null ) {
4974
4975
		// ( types, fn )
4976
		fn = selector;
4977
		data = selector = undefined;
4978
	} else if ( fn == null ) {
4979
		if ( typeof selector === "string" ) {
4980
4981
			// ( types, selector, fn )
4982
			fn = data;
4983
			data = undefined;
4984
		} else {
4985
4986
			// ( types, data, fn )
4987
			fn = data;
4988
			data = selector;
4989
			selector = undefined;
4990
		}
4991
	}
4992
	if ( fn === false ) {
4993
		fn = returnFalse;
4994
	} else if ( !fn ) {
4995
		return elem;
4996
	}
4997
4998
	if ( one === 1 ) {
4999
		origFn = fn;
5000
		fn = function( event ) {
5001
5002
			// Can use an empty set, since event contains the info
5003
			jQuery().off( event );
5004
			return origFn.apply( this, arguments );
5005
		};
5006
5007
		// Use same guid so caller can remove using origFn
5008
		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5009
	}
5010
	return elem.each( function() {
5011
		jQuery.event.add( this, types, fn, data, selector );
5012
	} );
5013
}
5014
5015
/*
5016
 * Helper functions for managing events -- not part of the public interface.
5017
 * Props to Dean Edwards' addEvent library for many of the ideas.
5018
 */
5019
jQuery.event = {
5020
5021
	global: {},
5022
5023
	add: function( elem, types, handler, data, selector ) {
5024
5025
		var handleObjIn, eventHandle, tmp,
5026
			events, t, handleObj,
5027
			special, handlers, type, namespaces, origType,
5028
			elemData = dataPriv.get( elem );
5029
5030
		// Don't attach events to noData or text/comment nodes (but allow plain objects)
5031
		if ( !elemData ) {
5032
			return;
5033
		}
5034
5035
		// Caller can pass in an object of custom data in lieu of the handler
5036
		if ( handler.handler ) {
5037
			handleObjIn = handler;
5038
			handler = handleObjIn.handler;
5039
			selector = handleObjIn.selector;
5040
		}
5041
5042
		// Ensure that invalid selectors throw exceptions at attach time
5043
		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
5044
		if ( selector ) {
5045
			jQuery.find.matchesSelector( documentElement, selector );
5046
		}
5047
5048
		// Make sure that the handler has a unique ID, used to find/remove it later
5049
		if ( !handler.guid ) {
5050
			handler.guid = jQuery.guid++;
5051
		}
5052
5053
		// Init the element's event structure and main handler, if this is the first
5054
		if ( !( events = elemData.events ) ) {
5055
			events = elemData.events = {};
5056
		}
5057
		if ( !( eventHandle = elemData.handle ) ) {
5058
			eventHandle = elemData.handle = function( e ) {
5059
5060
				// Discard the second event of a jQuery.event.trigger() and
5061
				// when an event is called after a page has unloaded
5062
				return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
5063
					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
5064
			};
5065
		}
5066
5067
		// Handle multiple events separated by a space
5068
		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5069
		t = types.length;
5070
		while ( t-- ) {
5071
			tmp = rtypenamespace.exec( types[ t ] ) || [];
5072
			type = origType = tmp[ 1 ];
5073
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5074
5075
			// There *must* be a type, no attaching namespace-only handlers
5076
			if ( !type ) {
5077
				continue;
5078
			}
5079
5080
			// If event changes its type, use the special event handlers for the changed type
5081
			special = jQuery.event.special[ type ] || {};
5082
5083
			// If selector defined, determine special event api type, otherwise given type
5084
			type = ( selector ? special.delegateType : special.bindType ) || type;
5085
5086
			// Update special based on newly reset type
5087
			special = jQuery.event.special[ type ] || {};
5088
5089
			// handleObj is passed to all event handlers
5090
			handleObj = jQuery.extend( {
5091
				type: type,
5092
				origType: origType,
5093
				data: data,
5094
				handler: handler,
5095
				guid: handler.guid,
5096
				selector: selector,
5097
				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5098
				namespace: namespaces.join( "." )
5099
			}, handleObjIn );
5100
5101
			// Init the event handler queue if we're the first
5102
			if ( !( handlers = events[ type ] ) ) {
5103
				handlers = events[ type ] = [];
5104
				handlers.delegateCount = 0;
5105
5106
				// Only use addEventListener if the special events handler returns false
5107
				if ( !special.setup ||
5108
					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5109
5110
					if ( elem.addEventListener ) {
5111
						elem.addEventListener( type, eventHandle );
5112
					}
5113
				}
5114
			}
5115
5116
			if ( special.add ) {
5117
				special.add.call( elem, handleObj );
5118
5119
				if ( !handleObj.handler.guid ) {
5120
					handleObj.handler.guid = handler.guid;
5121
				}
5122
			}
5123
5124
			// Add to the element's handler list, delegates in front
5125
			if ( selector ) {
5126
				handlers.splice( handlers.delegateCount++, 0, handleObj );
5127
			} else {
5128
				handlers.push( handleObj );
5129
			}
5130
5131
			// Keep track of which events have ever been used, for event optimization
5132
			jQuery.event.global[ type ] = true;
5133
		}
5134
5135
	},
5136
5137
	// Detach an event or set of events from an element
5138
	remove: function( elem, types, handler, selector, mappedTypes ) {
5139
5140
		var j, origCount, tmp,
5141
			events, t, handleObj,
5142
			special, handlers, type, namespaces, origType,
5143
			elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5144
5145
		if ( !elemData || !( events = elemData.events ) ) {
5146
			return;
5147
		}
5148
5149
		// Once for each type.namespace in types; type may be omitted
5150
		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5151
		t = types.length;
5152
		while ( t-- ) {
5153
			tmp = rtypenamespace.exec( types[ t ] ) || [];
5154
			type = origType = tmp[ 1 ];
5155
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5156
5157
			// Unbind all events (on this namespace, if provided) for the element
5158
			if ( !type ) {
5159
				for ( type in events ) {
5160
					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5161
				}
5162
				continue;
5163
			}
5164
5165
			special = jQuery.event.special[ type ] || {};
5166
			type = ( selector ? special.delegateType : special.bindType ) || type;
5167
			handlers = events[ type ] || [];
5168
			tmp = tmp[ 2 ] &&
5169
				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5170
5171
			// Remove matching events
5172
			origCount = j = handlers.length;
5173
			while ( j-- ) {
5174
				handleObj = handlers[ j ];
5175
5176
				if ( ( mappedTypes || origType === handleObj.origType ) &&
5177
					( !handler || handler.guid === handleObj.guid ) &&
5178
					( !tmp || tmp.test( handleObj.namespace ) ) &&
5179
					( !selector || selector === handleObj.selector ||
5180
						selector === "**" && handleObj.selector ) ) {
5181
					handlers.splice( j, 1 );
5182
5183
					if ( handleObj.selector ) {
5184
						handlers.delegateCount--;
5185
					}
5186
					if ( special.remove ) {
5187
						special.remove.call( elem, handleObj );
5188
					}
5189
				}
5190
			}
5191
5192
			// Remove generic event handler if we removed something and no more handlers exist
5193
			// (avoids potential for endless recursion during removal of special event handlers)
5194
			if ( origCount && !handlers.length ) {
5195
				if ( !special.teardown ||
5196
					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5197
5198
					jQuery.removeEvent( elem, type, elemData.handle );
5199
				}
5200
5201
				delete events[ type ];
5202
			}
5203
		}
5204
5205
		// Remove data and the expando if it's no longer used
5206
		if ( jQuery.isEmptyObject( events ) ) {
5207
			dataPriv.remove( elem, "handle events" );
5208
		}
5209
	},
5210
5211
	dispatch: function( nativeEvent ) {
5212
5213
		// Make a writable jQuery.Event from the native event object
5214
		var event = jQuery.event.fix( nativeEvent );
5215
5216
		var i, j, ret, matched, handleObj, handlerQueue,
5217
			args = new Array( arguments.length ),
5218
			handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5219
			special = jQuery.event.special[ event.type ] || {};
5220
5221
		// Use the fix-ed jQuery.Event rather than the (read-only) native event
5222
		args[ 0 ] = event;
5223
5224
		for ( i = 1; i < arguments.length; i++ ) {
5225
			args[ i ] = arguments[ i ];
5226
		}
5227
5228
		event.delegateTarget = this;
5229
5230
		// Call the preDispatch hook for the mapped type, and let it bail if desired
5231
		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5232
			return;
5233
		}
5234
5235
		// Determine handlers
5236
		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5237
5238
		// Run delegates first; they may want to stop propagation beneath us
5239
		i = 0;
5240
		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5241
			event.currentTarget = matched.elem;
5242
5243
			j = 0;
5244
			while ( ( handleObj = matched.handlers[ j++ ] ) &&
5245
				!event.isImmediatePropagationStopped() ) {
5246
5247
				// Triggered event must either 1) have no namespace, or 2) have namespace(s)
5248
				// a subset or equal to those in the bound event (both can have no namespace).
5249
				if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
5250
5251
					event.handleObj = handleObj;
5252
					event.data = handleObj.data;
5253
5254
					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5255
						handleObj.handler ).apply( matched.elem, args );
5256
5257
					if ( ret !== undefined ) {
5258
						if ( ( event.result = ret ) === false ) {
5259
							event.preventDefault();
5260
							event.stopPropagation();
5261
						}
5262
					}
5263
				}
5264
			}
5265
		}
5266
5267
		// Call the postDispatch hook for the mapped type
5268
		if ( special.postDispatch ) {
5269
			special.postDispatch.call( this, event );
5270
		}
5271
5272
		return event.result;
5273
	},
5274
5275
	handlers: function( event, handlers ) {
5276
		var i, handleObj, sel, matchedHandlers, matchedSelectors,
5277
			handlerQueue = [],
5278
			delegateCount = handlers.delegateCount,
5279
			cur = event.target;
5280
5281
		// Find delegate handlers
5282
		if ( delegateCount &&
5283
5284
			// Support: IE <=9
5285
			// Black-hole SVG <use> instance trees (trac-13180)
5286
			cur.nodeType &&
5287
5288
			// Support: Firefox <=42
5289
			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5290
			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5291
			// Support: IE 11 only
5292
			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5293
			!( event.type === "click" && event.button >= 1 ) ) {
5294
5295
			for ( ; cur !== this; cur = cur.parentNode || this ) {
5296
5297
				// Don't check non-elements (#13208)
5298
				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5299
				if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5300
					matchedHandlers = [];
5301
					matchedSelectors = {};
5302
					for ( i = 0; i < delegateCount; i++ ) {
5303
						handleObj = handlers[ i ];
5304
5305
						// Don't conflict with Object.prototype properties (#13203)
5306
						sel = handleObj.selector + " ";
5307
5308
						if ( matchedSelectors[ sel ] === undefined ) {
5309
							matchedSelectors[ sel ] = handleObj.needsContext ?
5310
								jQuery( sel, this ).index( cur ) > -1 :
5311
								jQuery.find( sel, this, null, [ cur ] ).length;
5312
						}
5313
						if ( matchedSelectors[ sel ] ) {
5314
							matchedHandlers.push( handleObj );
5315
						}
5316
					}
5317
					if ( matchedHandlers.length ) {
5318
						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5319
					}
5320
				}
5321
			}
5322
		}
5323
5324
		// Add the remaining (directly-bound) handlers
5325
		cur = this;
5326
		if ( delegateCount < handlers.length ) {
5327
			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5328
		}
5329
5330
		return handlerQueue;
5331
	},
5332
5333
	addProp: function( name, hook ) {
5334
		Object.defineProperty( jQuery.Event.prototype, name, {
5335
			enumerable: true,
5336
			configurable: true,
5337
5338
			get: isFunction( hook ) ?
5339
				function() {
5340
					if ( this.originalEvent ) {
5341
							return hook( this.originalEvent );
5342
					}
5343
				} :
5344
				function() {
5345
					if ( this.originalEvent ) {
5346
							return this.originalEvent[ name ];
5347
					}
5348
				},
5349
5350
			set: function( value ) {
5351
				Object.defineProperty( this, name, {
5352
					enumerable: true,
5353
					configurable: true,
5354
					writable: true,
5355
					value: value
5356
				} );
5357
			}
5358
		} );
5359
	},
5360
5361
	fix: function( originalEvent ) {
5362
		return originalEvent[ jQuery.expando ] ?
5363
			originalEvent :
5364
			new jQuery.Event( originalEvent );
5365
	},
5366
5367
	special: {
5368
		load: {
5369
5370
			// Prevent triggered image.load events from bubbling to window.load
5371
			noBubble: true
5372
		},
5373
		focus: {
5374
5375
			// Fire native event if possible so blur/focus sequence is correct
5376
			trigger: function() {
5377
				if ( this !== safeActiveElement() && this.focus ) {
5378
					this.focus();
5379
					return false;
5380
				}
5381
			},
5382
			delegateType: "focusin"
5383
		},
5384
		blur: {
5385
			trigger: function() {
5386
				if ( this === safeActiveElement() && this.blur ) {
5387
					this.blur();
5388
					return false;
5389
				}
5390
			},
5391
			delegateType: "focusout"
5392
		},
5393
		click: {
5394
5395
			// For checkbox, fire native event so checked state will be right
5396
			trigger: function() {
5397
				if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
5398
					this.click();
5399
					return false;
5400
				}
5401
			},
5402
5403
			// For cross-browser consistency, don't fire native .click() on links
5404
			_default: function( event ) {
5405
				return nodeName( event.target, "a" );
5406
			}
5407
		},
5408
5409
		beforeunload: {
5410
			postDispatch: function( event ) {
5411
5412
				// Support: Firefox 20+
5413
				// Firefox doesn't alert if the returnValue field is not set.
5414
				if ( event.result !== undefined && event.originalEvent ) {
5415
					event.originalEvent.returnValue = event.result;
5416
				}
5417
			}
5418
		}
5419
	}
5420
};
5421
5422
jQuery.removeEvent = function( elem, type, handle ) {
5423
5424
	// This "if" is needed for plain objects
5425
	if ( elem.removeEventListener ) {
5426
		elem.removeEventListener( type, handle );
5427
	}
5428
};
5429
5430
jQuery.Event = function( src, props ) {
5431
5432
	// Allow instantiation without the 'new' keyword
5433
	if ( !( this instanceof jQuery.Event ) ) {
5434
		return new jQuery.Event( src, props );
5435
	}
5436
5437
	// Event object
5438
	if ( src && src.type ) {
5439
		this.originalEvent = src;
5440
		this.type = src.type;
5441
5442
		// Events bubbling up the document may have been marked as prevented
5443
		// by a handler lower down the tree; reflect the correct value.
5444
		this.isDefaultPrevented = src.defaultPrevented ||
5445
				src.defaultPrevented === undefined &&
5446
5447
				// Support: Android <=2.3 only
5448
				src.returnValue === false ?
5449
			returnTrue :
5450
			returnFalse;
5451
5452
		// Create target properties
5453
		// Support: Safari <=6 - 7 only
5454
		// Target should not be a text node (#504, #13143)
5455
		this.target = ( src.target && src.target.nodeType === 3 ) ?
5456
			src.target.parentNode :
5457
			src.target;
5458
5459
		this.currentTarget = src.currentTarget;
5460
		this.relatedTarget = src.relatedTarget;
5461
5462
	// Event type
5463
	} else {
5464
		this.type = src;
5465
	}
5466
5467
	// Put explicitly provided properties onto the event object
5468
	if ( props ) {
5469
		jQuery.extend( this, props );
5470
	}
5471
5472
	// Create a timestamp if incoming event doesn't have one
5473
	this.timeStamp = src && src.timeStamp || Date.now();
5474
5475
	// Mark it as fixed
5476
	this[ jQuery.expando ] = true;
5477
};
5478
5479
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5480
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5481
jQuery.Event.prototype = {
5482
	constructor: jQuery.Event,
5483
	isDefaultPrevented: returnFalse,
5484
	isPropagationStopped: returnFalse,
5485
	isImmediatePropagationStopped: returnFalse,
5486
	isSimulated: false,
5487
5488
	preventDefault: function() {
5489
		var e = this.originalEvent;
5490
5491
		this.isDefaultPrevented = returnTrue;
5492
5493
		if ( e && !this.isSimulated ) {
5494
			e.preventDefault();
5495
		}
5496
	},
5497
	stopPropagation: function() {
5498
		var e = this.originalEvent;
5499
5500
		this.isPropagationStopped = returnTrue;
5501
5502
		if ( e && !this.isSimulated ) {
5503
			e.stopPropagation();
5504
		}
5505
	},
5506
	stopImmediatePropagation: function() {
5507
		var e = this.originalEvent;
5508
5509
		this.isImmediatePropagationStopped = returnTrue;
5510
5511
		if ( e && !this.isSimulated ) {
5512
			e.stopImmediatePropagation();
5513
		}
5514
5515
		this.stopPropagation();
5516
	}
5517
};
5518
5519
// Includes all common event props including KeyEvent and MouseEvent specific props
5520
jQuery.each( {
5521
	altKey: true,
5522
	bubbles: true,
5523
	cancelable: true,
5524
	changedTouches: true,
5525
	ctrlKey: true,
5526
	detail: true,
5527
	eventPhase: true,
5528
	metaKey: true,
5529
	pageX: true,
5530
	pageY: true,
5531
	shiftKey: true,
5532
	view: true,
5533
	"char": true,
5534
	charCode: true,
5535
	key: true,
5536
	keyCode: true,
5537
	button: true,
5538
	buttons: true,
5539
	clientX: true,
5540
	clientY: true,
5541
	offsetX: true,
5542
	offsetY: true,
5543
	pointerId: true,
5544
	pointerType: true,
5545
	screenX: true,
5546
	screenY: true,
5547
	targetTouches: true,
5548
	toElement: true,
5549
	touches: true,
5550
5551
	which: function( event ) {
5552
		var button = event.button;
5553
5554
		// Add which for key events
5555
		if ( event.which == null && rkeyEvent.test( event.type ) ) {
5556
			return event.charCode != null ? event.charCode : event.keyCode;
5557
		}
5558
5559
		// Add which for click: 1 === left; 2 === middle; 3 === right
5560
		if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5561
			if ( button & 1 ) {
5562
				return 1;
5563
			}
5564
5565
			if ( button & 2 ) {
5566
				return 3;
5567
			}
5568
5569
			if ( button & 4 ) {
5570
				return 2;
5571
			}
5572
5573
			return 0;
5574
		}
5575
5576
		return event.which;
5577
	}
5578
}, jQuery.event.addProp );
5579
5580
// Create mouseenter/leave events using mouseover/out and event-time checks
5581
// so that event delegation works in jQuery.
5582
// Do the same for pointerenter/pointerleave and pointerover/pointerout
5583
//
5584
// Support: Safari 7 only
5585
// Safari sends mouseenter too often; see:
5586
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5587
// for the description of the bug (it existed in older Chrome versions as well).
5588
jQuery.each( {
5589
	mouseenter: "mouseover",
5590
	mouseleave: "mouseout",
5591
	pointerenter: "pointerover",
5592
	pointerleave: "pointerout"
5593
}, function( orig, fix ) {
5594
	jQuery.event.special[ orig ] = {
5595
		delegateType: fix,
5596
		bindType: fix,
5597
5598
		handle: function( event ) {
5599
			var ret,
5600
				target = this,
5601
				related = event.relatedTarget,
5602
				handleObj = event.handleObj;
5603
5604
			// For mouseenter/leave call the handler if related is outside the target.
5605
			// NB: No relatedTarget if the mouse left/entered the browser window
5606
			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5607
				event.type = handleObj.origType;
5608
				ret = handleObj.handler.apply( this, arguments );
5609
				event.type = fix;
5610
			}
5611
			return ret;
5612
		}
5613
	};
5614
} );
5615
5616
jQuery.fn.extend( {
5617
5618
	on: function( types, selector, data, fn ) {
5619
		return on( this, types, selector, data, fn );
5620
	},
5621
	one: function( types, selector, data, fn ) {
5622
		return on( this, types, selector, data, fn, 1 );
5623
	},
5624
	off: function( types, selector, fn ) {
5625
		var handleObj, type;
5626
		if ( types && types.preventDefault && types.handleObj ) {
5627
5628
			// ( event )  dispatched jQuery.Event
5629
			handleObj = types.handleObj;
5630
			jQuery( types.delegateTarget ).off(
5631
				handleObj.namespace ?
5632
					handleObj.origType + "." + handleObj.namespace :
5633
					handleObj.origType,
5634
				handleObj.selector,
5635
				handleObj.handler
5636
			);
5637
			return this;
5638
		}
5639
		if ( typeof types === "object" ) {
5640
5641
			// ( types-object [, selector] )
5642
			for ( type in types ) {
5643
				this.off( type, selector, types[ type ] );
5644
			}
5645
			return this;
5646
		}
5647
		if ( selector === false || typeof selector === "function" ) {
5648
5649
			// ( types [, fn] )
5650
			fn = selector;
5651
			selector = undefined;
5652
		}
5653
		if ( fn === false ) {
5654
			fn = returnFalse;
5655
		}
5656
		return this.each( function() {
5657
			jQuery.event.remove( this, types, fn, selector );
5658
		} );
5659
	}
5660
} );
5661
5662
5663
var
5664
5665
	/* eslint-disable max-len */
5666
5667
	// See https://github.com/eslint/eslint/issues/3229
5668
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5669
5670
	/* eslint-enable */
5671
5672
	// Support: IE <=10 - 11, Edge 12 - 13 only
5673
	// In IE/Edge using regex groups here causes severe slowdowns.
5674
	// See https://connect.microsoft.com/IE/feedback/details/1736512/
5675
	rnoInnerhtml = /<script|<style|<link/i,
5676
5677
	// checked="checked" or checked
5678
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5679
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5680
5681
// Prefer a tbody over its parent table for containing new rows
5682
function manipulationTarget( elem, content ) {
5683
	if ( nodeName( elem, "table" ) &&
5684
		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5685
5686
		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5687
	}
5688
5689
	return elem;
5690
}
5691
5692
// Replace/restore the type attribute of script elements for safe DOM manipulation
5693
function disableScript( elem ) {
5694
	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5695
	return elem;
5696
}
5697
function restoreScript( elem ) {
5698
	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5699
		elem.type = elem.type.slice( 5 );
5700
	} else {
5701
		elem.removeAttribute( "type" );
5702
	}
5703
5704
	return elem;
5705
}
5706
5707
function cloneCopyEvent( src, dest ) {
5708
	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5709
5710
	if ( dest.nodeType !== 1 ) {
5711
		return;
5712
	}
5713
5714
	// 1. Copy private data: events, handlers, etc.
5715
	if ( dataPriv.hasData( src ) ) {
5716
		pdataOld = dataPriv.access( src );
5717
		pdataCur = dataPriv.set( dest, pdataOld );
5718
		events = pdataOld.events;
5719
5720
		if ( events ) {
5721
			delete pdataCur.handle;
5722
			pdataCur.events = {};
5723
5724
			for ( type in events ) {
5725
				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5726
					jQuery.event.add( dest, type, events[ type ][ i ] );
5727
				}
5728
			}
5729
		}
5730
	}
5731
5732
	// 2. Copy user data
5733
	if ( dataUser.hasData( src ) ) {
5734
		udataOld = dataUser.access( src );
5735
		udataCur = jQuery.extend( {}, udataOld );
5736
5737
		dataUser.set( dest, udataCur );
5738
	}
5739
}
5740
5741
// Fix IE bugs, see support tests
5742
function fixInput( src, dest ) {
5743
	var nodeName = dest.nodeName.toLowerCase();
5744
5745
	// Fails to persist the checked state of a cloned checkbox or radio button.
5746
	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5747
		dest.checked = src.checked;
5748
5749
	// Fails to return the selected option to the default selected state when cloning options
5750
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
5751
		dest.defaultValue = src.defaultValue;
5752
	}
5753
}
5754
5755
function domManip( collection, args, callback, ignored ) {
5756
5757
	// Flatten any nested arrays
5758
	args = concat.apply( [], args );
5759
5760
	var fragment, first, scripts, hasScripts, node, doc,
5761
		i = 0,
5762
		l = collection.length,
5763
		iNoClone = l - 1,
5764
		value = args[ 0 ],
5765
		valueIsFunction = isFunction( value );
5766
5767
	// We can't cloneNode fragments that contain checked, in WebKit
5768
	if ( valueIsFunction ||
5769
			( l > 1 && typeof value === "string" &&
5770
				!support.checkClone && rchecked.test( value ) ) ) {
5771
		return collection.each( function( index ) {
5772
			var self = collection.eq( index );
5773
			if ( valueIsFunction ) {
5774
				args[ 0 ] = value.call( this, index, self.html() );
5775
			}
5776
			domManip( self, args, callback, ignored );
5777
		} );
5778
	}
5779
5780
	if ( l ) {
5781
		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5782
		first = fragment.firstChild;
5783
5784
		if ( fragment.childNodes.length === 1 ) {
5785
			fragment = first;
5786
		}
5787
5788
		// Require either new content or an interest in ignored elements to invoke the callback
5789
		if ( first || ignored ) {
5790
			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5791
			hasScripts = scripts.length;
5792
5793
			// Use the original fragment for the last item
5794
			// instead of the first because it can end up
5795
			// being emptied incorrectly in certain situations (#8070).
5796
			for ( ; i < l; i++ ) {
5797
				node = fragment;
5798
5799
				if ( i !== iNoClone ) {
5800
					node = jQuery.clone( node, true, true );
5801
5802
					// Keep references to cloned scripts for later restoration
5803
					if ( hasScripts ) {
5804
5805
						// Support: Android <=4.0 only, PhantomJS 1 only
5806
						// push.apply(_, arraylike) throws on ancient WebKit
5807
						jQuery.merge( scripts, getAll( node, "script" ) );
5808
					}
5809
				}
5810
5811
				callback.call( collection[ i ], node, i );
5812
			}
5813
5814
			if ( hasScripts ) {
5815
				doc = scripts[ scripts.length - 1 ].ownerDocument;
5816
5817
				// Reenable scripts
5818
				jQuery.map( scripts, restoreScript );
5819
5820
				// Evaluate executable scripts on first document insertion
5821
				for ( i = 0; i < hasScripts; i++ ) {
5822
					node = scripts[ i ];
5823
					if ( rscriptType.test( node.type || "" ) &&
5824
						!dataPriv.access( node, "globalEval" ) &&
5825
						jQuery.contains( doc, node ) ) {
5826
5827
						if ( node.src && ( node.type || "" ).toLowerCase()  !== "module" ) {
5828
5829
							// Optional AJAX dependency, but won't run scripts if not present
5830
							if ( jQuery._evalUrl ) {
5831
								jQuery._evalUrl( node.src );
5832
							}
5833
						} else {
5834
							DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
5835
						}
5836
					}
5837
				}
5838
			}
5839
		}
5840
	}
5841
5842
	return collection;
5843
}
5844
5845
function remove( elem, selector, keepData ) {
5846
	var node,
5847
		nodes = selector ? jQuery.filter( selector, elem ) : elem,
5848
		i = 0;
5849
5850
	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5851
		if ( !keepData && node.nodeType === 1 ) {
5852
			jQuery.cleanData( getAll( node ) );
5853
		}
5854
5855
		if ( node.parentNode ) {
5856
			if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
5857
				setGlobalEval( getAll( node, "script" ) );
5858
			}
5859
			node.parentNode.removeChild( node );
5860
		}
5861
	}
5862
5863
	return elem;
5864
}
5865
5866
jQuery.extend( {
5867
	htmlPrefilter: function( html ) {
5868
		return html.replace( rxhtmlTag, "<$1></$2>" );
5869
	},
5870
5871
	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5872
		var i, l, srcElements, destElements,
5873
			clone = elem.cloneNode( true ),
5874
			inPage = jQuery.contains( elem.ownerDocument, elem );
5875
5876
		// Fix IE cloning issues
5877
		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5878
				!jQuery.isXMLDoc( elem ) ) {
5879
5880
			// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5881
			destElements = getAll( clone );
5882
			srcElements = getAll( elem );
5883
5884
			for ( i = 0, l = srcElements.length; i < l; i++ ) {
5885
				fixInput( srcElements[ i ], destElements[ i ] );
5886
			}
5887
		}
5888
5889
		// Copy the events from the original to the clone
5890
		if ( dataAndEvents ) {
5891
			if ( deepDataAndEvents ) {
5892
				srcElements = srcElements || getAll( elem );
5893
				destElements = destElements || getAll( clone );
5894
5895
				for ( i = 0, l = srcElements.length; i < l; i++ ) {
5896
					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5897
				}
5898
			} else {
5899
				cloneCopyEvent( elem, clone );
5900
			}
5901
		}
5902
5903
		// Preserve script evaluation history
5904
		destElements = getAll( clone, "script" );
5905
		if ( destElements.length > 0 ) {
5906
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5907
		}
5908
5909
		// Return the cloned set
5910
		return clone;
5911
	},
5912
5913
	cleanData: function( elems ) {
5914
		var data, elem, type,
5915
			special = jQuery.event.special,
5916
			i = 0;
5917
5918
		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5919
			if ( acceptData( elem ) ) {
5920
				if ( ( data = elem[ dataPriv.expando ] ) ) {
5921
					if ( data.events ) {
5922
						for ( type in data.events ) {
5923
							if ( special[ type ] ) {
5924
								jQuery.event.remove( elem, type );
5925
5926
							// This is a shortcut to avoid jQuery.event.remove's overhead
5927
							} else {
5928
								jQuery.removeEvent( elem, type, data.handle );
5929
							}
5930
						}
5931
					}
5932
5933
					// Support: Chrome <=35 - 45+
5934
					// Assign undefined instead of using delete, see Data#remove
5935
					elem[ dataPriv.expando ] = undefined;
5936
				}
5937
				if ( elem[ dataUser.expando ] ) {
5938
5939
					// Support: Chrome <=35 - 45+
5940
					// Assign undefined instead of using delete, see Data#remove
5941
					elem[ dataUser.expando ] = undefined;
5942
				}
5943
			}
5944
		}
5945
	}
5946
} );
5947
5948
jQuery.fn.extend( {
5949
	detach: function( selector ) {
5950
		return remove( this, selector, true );
5951
	},
5952
5953
	remove: function( selector ) {
5954
		return remove( this, selector );
5955
	},
5956
5957
	text: function( value ) {
5958
		return access( this, function( value ) {
5959
			return value === undefined ?
5960
				jQuery.text( this ) :
5961
				this.empty().each( function() {
5962
					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5963
						this.textContent = value;
5964
					}
5965
				} );
5966
		}, null, value, arguments.length );
5967
	},
5968
5969
	append: function() {
5970
		return domManip( this, arguments, function( elem ) {
5971
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5972
				var target = manipulationTarget( this, elem );
5973
				target.appendChild( elem );
5974
			}
5975
		} );
5976
	},
5977
5978
	prepend: function() {
5979
		return domManip( this, arguments, function( elem ) {
5980
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5981
				var target = manipulationTarget( this, elem );
5982
				target.insertBefore( elem, target.firstChild );
5983
			}
5984
		} );
5985
	},
5986
5987
	before: function() {
5988
		return domManip( this, arguments, function( elem ) {
5989
			if ( this.parentNode ) {
5990
				this.parentNode.insertBefore( elem, this );
5991
			}
5992
		} );
5993
	},
5994
5995
	after: function() {
5996
		return domManip( this, arguments, function( elem ) {
5997
			if ( this.parentNode ) {
5998
				this.parentNode.insertBefore( elem, this.nextSibling );
5999
			}
6000
		} );
6001
	},
6002
6003
	empty: function() {
6004
		var elem,
6005
			i = 0;
6006
6007
		for ( ; ( elem = this[ i ] ) != null; i++ ) {
6008
			if ( elem.nodeType === 1 ) {
6009
6010
				// Prevent memory leaks
6011
				jQuery.cleanData( getAll( elem, false ) );
6012
6013
				// Remove any remaining nodes
6014
				elem.textContent = "";
6015
			}
6016
		}
6017
6018
		return this;
6019
	},
6020
6021
	clone: function( dataAndEvents, deepDataAndEvents ) {
6022
		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6023
		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6024
6025
		return this.map( function() {
6026
			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6027
		} );
6028
	},
6029
6030
	html: function( value ) {
6031
		return access( this, function( value ) {
6032
			var elem = this[ 0 ] || {},
6033
				i = 0,
6034
				l = this.length;
6035
6036
			if ( value === undefined && elem.nodeType === 1 ) {
6037
				return elem.innerHTML;
6038
			}
6039
6040
			// See if we can take a shortcut and just use innerHTML
6041
			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6042
				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
6043
6044
				value = jQuery.htmlPrefilter( value );
6045
6046
				try {
6047
					for ( ; i < l; i++ ) {
6048
						elem = this[ i ] || {};
6049
6050
						// Remove element nodes and prevent memory leaks
6051
						if ( elem.nodeType === 1 ) {
6052
							jQuery.cleanData( getAll( elem, false ) );
6053
							elem.innerHTML = value;
6054
						}
6055
					}
6056
6057
					elem = 0;
6058
6059
				// If using innerHTML throws an exception, use the fallback method
6060
				} catch ( e ) {}
6061
			}
6062
6063
			if ( elem ) {
6064
				this.empty().append( value );
6065
			}
6066
		}, null, value, arguments.length );
6067
	},
6068
6069
	replaceWith: function() {
6070
		var ignored = [];
6071
6072
		// Make the changes, replacing each non-ignored context element with the new content
6073
		return domManip( this, arguments, function( elem ) {
6074
			var parent = this.parentNode;
6075
6076
			if ( jQuery.inArray( this, ignored ) < 0 ) {
6077
				jQuery.cleanData( getAll( this ) );
6078
				if ( parent ) {
6079
					parent.replaceChild( elem, this );
6080
				}
6081
			}
6082
6083
		// Force callback invocation
6084
		}, ignored );
6085
	}
6086
} );
6087
6088
jQuery.each( {
6089
	appendTo: "append",
6090
	prependTo: "prepend",
6091
	insertBefore: "before",
6092
	insertAfter: "after",
6093
	replaceAll: "replaceWith"
6094
}, function( name, original ) {
6095
	jQuery.fn[ name ] = function( selector ) {
6096
		var elems,
6097
			ret = [],
6098
			insert = jQuery( selector ),
6099
			last = insert.length - 1,
6100
			i = 0;
6101
6102
		for ( ; i <= last; i++ ) {
6103
			elems = i === last ? this : this.clone( true );
6104
			jQuery( insert[ i ] )[ original ]( elems );
6105
6106
			// Support: Android <=4.0 only, PhantomJS 1 only
6107
			// .get() because push.apply(_, arraylike) throws on ancient WebKit
6108
			push.apply( ret, elems.get() );
6109
		}
6110
6111
		return this.pushStack( ret );
6112
	};
6113
} );
6114
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6115
6116
var getStyles = function( elem ) {
6117
6118
		// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
6119
		// IE throws on elements created in popups
6120
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6121
		var view = elem.ownerDocument.defaultView;
6122
6123
		if ( !view || !view.opener ) {
6124
			view = window;
6125
		}
6126
6127
		return view.getComputedStyle( elem );
6128
	};
6129
6130
var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6131
6132
6133
6134
( function() {
6135
6136
	// Executing both pixelPosition & boxSizingReliable tests require only one layout
6137
	// so they're executed at the same time to save the second computation.
6138
	function computeStyleTests() {
6139
6140
		// This is a singleton, we need to execute it only once
6141
		if ( !div ) {
6142
			return;
6143
		}
6144
6145
		container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6146
			"margin-top:1px;padding:0;border:0";
6147
		div.style.cssText =
6148
			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6149
			"margin:auto;border:1px;padding:1px;" +
6150
			"width:60%;top:1%";
6151
		documentElement.appendChild( container ).appendChild( div );
6152
6153
		var divStyle = window.getComputedStyle( div );
6154
		pixelPositionVal = divStyle.top !== "1%";
6155
6156
		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6157
		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6158
6159
		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6160
		// Some styles come back with percentage values, even though they shouldn't
6161
		div.style.right = "60%";
6162
		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6163
6164
		// Support: IE 9 - 11 only
6165
		// Detect misreporting of content dimensions for box-sizing:border-box elements
6166
		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6167
6168
		// Support: IE 9 only
6169
		// Detect overflow:scroll screwiness (gh-3699)
6170
		div.style.position = "absolute";
6171
		scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
6172
6173
		documentElement.removeChild( container );
6174
6175
		// Nullify the div so it wouldn't be stored in the memory and
6176
		// it will also be a sign that checks already performed
6177
		div = null;
6178
	}
6179
6180
	function roundPixelMeasures( measure ) {
6181
		return Math.round( parseFloat( measure ) );
6182
	}
6183
6184
	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6185
		reliableMarginLeftVal,
6186
		container = document.createElement( "div" ),
6187
		div = document.createElement( "div" );
6188
6189
	// Finish early in limited (non-browser) environments
6190
	if ( !div.style ) {
6191
		return;
6192
	}
6193
6194
	// Support: IE <=9 - 11 only
6195
	// Style of cloned element affects source element cloned (#8908)
6196
	div.style.backgroundClip = "content-box";
6197
	div.cloneNode( true ).style.backgroundClip = "";
6198
	support.clearCloneStyle = div.style.backgroundClip === "content-box";
6199
6200
	jQuery.extend( support, {
6201
		boxSizingReliable: function() {
6202
			computeStyleTests();
6203
			return boxSizingReliableVal;
6204
		},
6205
		pixelBoxStyles: function() {
6206
			computeStyleTests();
6207
			return pixelBoxStylesVal;
6208
		},
6209
		pixelPosition: function() {
6210
			computeStyleTests();
6211
			return pixelPositionVal;
6212
		},
6213
		reliableMarginLeft: function() {
6214
			computeStyleTests();
6215
			return reliableMarginLeftVal;
6216
		},
6217
		scrollboxSize: function() {
6218
			computeStyleTests();
6219
			return scrollboxSizeVal;
6220
		}
6221
	} );
6222
} )();
6223
6224
6225
function curCSS( elem, name, computed ) {
6226
	var width, minWidth, maxWidth, ret,
6227
6228
		// Support: Firefox 51+
6229
		// Retrieving style before computed somehow
6230
		// fixes an issue with getting wrong values
6231
		// on detached elements
6232
		style = elem.style;
6233
6234
	computed = computed || getStyles( elem );
6235
6236
	// getPropertyValue is needed for:
6237
	//   .css('filter') (IE 9 only, #12537)
6238
	//   .css('--customProperty) (#3144)
6239
	if ( computed ) {
6240
		ret = computed.getPropertyValue( name ) || computed[ name ];
6241
6242
		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6243
			ret = jQuery.style( elem, name );
6244
		}
6245
6246
		// A tribute to the "awesome hack by Dean Edwards"
6247
		// Android Browser returns percentage for some values,
6248
		// but width seems to be reliably pixels.
6249
		// This is against the CSSOM draft spec:
6250
		// https://drafts.csswg.org/cssom/#resolved-values
6251
		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6252
6253
			// Remember the original values
6254
			width = style.width;
6255
			minWidth = style.minWidth;
6256
			maxWidth = style.maxWidth;
6257
6258
			// Put in the new values to get a computed value out
6259
			style.minWidth = style.maxWidth = style.width = ret;
6260
			ret = computed.width;
6261
6262
			// Revert the changed values
6263
			style.width = width;
6264
			style.minWidth = minWidth;
6265
			style.maxWidth = maxWidth;
6266
		}
6267
	}
6268
6269
	return ret !== undefined ?
6270
6271
		// Support: IE <=9 - 11 only
6272
		// IE returns zIndex value as an integer.
6273
		ret + "" :
6274
		ret;
6275
}
6276
6277
6278
function addGetHookIf( conditionFn, hookFn ) {
6279
6280
	// Define the hook, we'll check on the first run if it's really needed.
6281
	return {
6282
		get: function() {
6283
			if ( conditionFn() ) {
6284
6285
				// Hook not needed (or it's not possible to use it due
6286
				// to missing dependency), remove it.
6287
				delete this.get;
6288
				return;
6289
			}
6290
6291
			// Hook needed; redefine it so that the support test is not executed again.
6292
			return ( this.get = hookFn ).apply( this, arguments );
6293
		}
6294
	};
6295
}
6296
6297
6298
var
6299
6300
	// Swappable if display is none or starts with table
6301
	// except "table", "table-cell", or "table-caption"
6302
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6303
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6304
	rcustomProp = /^--/,
6305
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6306
	cssNormalTransform = {
6307
		letterSpacing: "0",
6308
		fontWeight: "400"
6309
	},
6310
6311
	cssPrefixes = [ "Webkit", "Moz", "ms" ],
6312
	emptyStyle = document.createElement( "div" ).style;
6313
6314
// Return a css property mapped to a potentially vendor prefixed property
6315
function vendorPropName( name ) {
6316
6317
	// Shortcut for names that are not vendor prefixed
6318
	if ( name in emptyStyle ) {
6319
		return name;
6320
	}
6321
6322
	// Check for vendor prefixed names
6323
	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6324
		i = cssPrefixes.length;
6325
6326
	while ( i-- ) {
6327
		name = cssPrefixes[ i ] + capName;
6328
		if ( name in emptyStyle ) {
6329
			return name;
6330
		}
6331
	}
6332
}
6333
6334
// Return a property mapped along what jQuery.cssProps suggests or to
6335
// a vendor prefixed property.
6336
function finalPropName( name ) {
6337
	var ret = jQuery.cssProps[ name ];
6338
	if ( !ret ) {
6339
		ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
6340
	}
6341
	return ret;
6342
}
6343
6344
function setPositiveNumber( elem, value, subtract ) {
6345
6346
	// Any relative (+/-) values have already been
6347
	// normalized at this point
6348
	var matches = rcssNum.exec( value );
6349
	return matches ?
6350
6351
		// Guard against undefined "subtract", e.g., when used as in cssHooks
6352
		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6353
		value;
6354
}
6355
6356
function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6357
	var i = dimension === "width" ? 1 : 0,
6358
		extra = 0,
6359
		delta = 0;
6360
6361
	// Adjustment may not be necessary
6362
	if ( box === ( isBorderBox ? "border" : "content" ) ) {
6363
		return 0;
6364
	}
6365
6366
	for ( ; i < 4; i += 2 ) {
6367
6368
		// Both box models exclude margin
6369
		if ( box === "margin" ) {
6370
			delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6371
		}
6372
6373
		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6374
		if ( !isBorderBox ) {
6375
6376
			// Add padding
6377
			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6378
6379
			// For "border" or "margin", add border
6380
			if ( box !== "padding" ) {
6381
				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6382
6383
			// But still keep track of it otherwise
6384
			} else {
6385
				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6386
			}
6387
6388
		// If we get here with a border-box (content + padding + border), we're seeking "content" or
6389
		// "padding" or "margin"
6390
		} else {
6391
6392
			// For "content", subtract padding
6393
			if ( box === "content" ) {
6394
				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6395
			}
6396
6397
			// For "content" or "padding", subtract border
6398
			if ( box !== "margin" ) {
6399
				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6400
			}
6401
		}
6402
	}
6403
6404
	// Account for positive content-box scroll gutter when requested by providing computedVal
6405
	if ( !isBorderBox && computedVal >= 0 ) {
6406
6407
		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6408
		// Assuming integer scroll gutter, subtract the rest and round down
6409
		delta += Math.max( 0, Math.ceil(
6410
			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6411
			computedVal -
6412
			delta -
6413
			extra -
6414
			0.5
6415
		) );
6416
	}
6417
6418
	return delta;
6419
}
6420
6421
function getWidthOrHeight( elem, dimension, extra ) {
6422
6423
	// Start with computed style
6424
	var styles = getStyles( elem ),
6425
		val = curCSS( elem, dimension, styles ),
6426
		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6427
		valueIsBorderBox = isBorderBox;
6428
6429
	// Support: Firefox <=54
6430
	// Return a confounding non-pixel value or feign ignorance, as appropriate.
6431
	if ( rnumnonpx.test( val ) ) {
6432
		if ( !extra ) {
6433
			return val;
6434
		}
6435
		val = "auto";
6436
	}
6437
6438
	// Check for style in case a browser which returns unreliable values
6439
	// for getComputedStyle silently falls back to the reliable elem.style
6440
	valueIsBorderBox = valueIsBorderBox &&
6441
		( support.boxSizingReliable() || val === elem.style[ dimension ] );
6442
6443
	// Fall back to offsetWidth/offsetHeight when value is "auto"
6444
	// This happens for inline elements with no explicit setting (gh-3571)
6445
	// Support: Android <=4.1 - 4.3 only
6446
	// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6447
	if ( val === "auto" ||
6448
		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
6449
6450
		val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
6451
6452
		// offsetWidth/offsetHeight provide border-box values
6453
		valueIsBorderBox = true;
6454
	}
6455
6456
	// Normalize "" and auto
6457
	val = parseFloat( val ) || 0;
6458
6459
	// Adjust for the element's box model
6460
	return ( val +
6461
		boxModelAdjustment(
6462
			elem,
6463
			dimension,
6464
			extra || ( isBorderBox ? "border" : "content" ),
6465
			valueIsBorderBox,
6466
			styles,
6467
6468
			// Provide the current computed size to request scroll gutter calculation (gh-3589)
6469
			val
6470
		)
6471
	) + "px";
6472
}
6473
6474
jQuery.extend( {
6475
6476
	// Add in style property hooks for overriding the default
6477
	// behavior of getting and setting a style property
6478
	cssHooks: {
6479
		opacity: {
6480
			get: function( elem, computed ) {
6481
				if ( computed ) {
6482
6483
					// We should always get a number back from opacity
6484
					var ret = curCSS( elem, "opacity" );
6485
					return ret === "" ? "1" : ret;
6486
				}
6487
			}
6488
		}
6489
	},
6490
6491
	// Don't automatically add "px" to these possibly-unitless properties
6492
	cssNumber: {
6493
		"animationIterationCount": true,
6494
		"columnCount": true,
6495
		"fillOpacity": true,
6496
		"flexGrow": true,
6497
		"flexShrink": true,
6498
		"fontWeight": true,
6499
		"lineHeight": true,
6500
		"opacity": true,
6501
		"order": true,
6502
		"orphans": true,
6503
		"widows": true,
6504
		"zIndex": true,
6505
		"zoom": true
6506
	},
6507
6508
	// Add in properties whose names you wish to fix before
6509
	// setting or getting the value
6510
	cssProps: {},
6511
6512
	// Get and set the style property on a DOM Node
6513
	style: function( elem, name, value, extra ) {
6514
6515
		// Don't set styles on text and comment nodes
6516
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6517
			return;
6518
		}
6519
6520
		// Make sure that we're working with the right name
6521
		var ret, type, hooks,
6522
			origName = camelCase( name ),
6523
			isCustomProp = rcustomProp.test( name ),
6524
			style = elem.style;
6525
6526
		// Make sure that we're working with the right name. We don't
6527
		// want to query the value if it is a CSS custom property
6528
		// since they are user-defined.
6529
		if ( !isCustomProp ) {
6530
			name = finalPropName( origName );
6531
		}
6532
6533
		// Gets hook for the prefixed version, then unprefixed version
6534
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6535
6536
		// Check if we're setting a value
6537
		if ( value !== undefined ) {
6538
			type = typeof value;
6539
6540
			// Convert "+=" or "-=" to relative numbers (#7345)
6541
			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6542
				value = adjustCSS( elem, name, ret );
6543
6544
				// Fixes bug #9237
6545
				type = "number";
6546
			}
6547
6548
			// Make sure that null and NaN values aren't set (#7116)
6549
			if ( value == null || value !== value ) {
6550
				return;
6551
			}
6552
6553
			// If a number was passed in, add the unit (except for certain CSS properties)
6554
			if ( type === "number" ) {
6555
				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6556
			}
6557
6558
			// background-* props affect original clone's values
6559
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6560
				style[ name ] = "inherit";
6561
			}
6562
6563
			// If a hook was provided, use that value, otherwise just set the specified value
6564
			if ( !hooks || !( "set" in hooks ) ||
6565
				( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6566
6567
				if ( isCustomProp ) {
6568
					style.setProperty( name, value );
6569
				} else {
6570
					style[ name ] = value;
6571
				}
6572
			}
6573
6574
		} else {
6575
6576
			// If a hook was provided get the non-computed value from there
6577
			if ( hooks && "get" in hooks &&
6578
				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6579
6580
				return ret;
6581
			}
6582
6583
			// Otherwise just get the value from the style object
6584
			return style[ name ];
6585
		}
6586
	},
6587
6588
	css: function( elem, name, extra, styles ) {
6589
		var val, num, hooks,
6590
			origName = camelCase( name ),
6591
			isCustomProp = rcustomProp.test( name );
6592
6593
		// Make sure that we're working with the right name. We don't
6594
		// want to modify the value if it is a CSS custom property
6595
		// since they are user-defined.
6596
		if ( !isCustomProp ) {
6597
			name = finalPropName( origName );
6598
		}
6599
6600
		// Try prefixed name followed by the unprefixed name
6601
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6602
6603
		// If a hook was provided get the computed value from there
6604
		if ( hooks && "get" in hooks ) {
6605
			val = hooks.get( elem, true, extra );
6606
		}
6607
6608
		// Otherwise, if a way to get the computed value exists, use that
6609
		if ( val === undefined ) {
6610
			val = curCSS( elem, name, styles );
6611
		}
6612
6613
		// Convert "normal" to computed value
6614
		if ( val === "normal" && name in cssNormalTransform ) {
6615
			val = cssNormalTransform[ name ];
6616
		}
6617
6618
		// Make numeric if forced or a qualifier was provided and val looks numeric
6619
		if ( extra === "" || extra ) {
6620
			num = parseFloat( val );
6621
			return extra === true || isFinite( num ) ? num || 0 : val;
6622
		}
6623
6624
		return val;
6625
	}
6626
} );
6627
6628
jQuery.each( [ "height", "width" ], function( i, dimension ) {
6629
	jQuery.cssHooks[ dimension ] = {
6630
		get: function( elem, computed, extra ) {
6631
			if ( computed ) {
6632
6633
				// Certain elements can have dimension info if we invisibly show them
6634
				// but it must have a current display style that would benefit
6635
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6636
6637
					// Support: Safari 8+
6638
					// Table columns in Safari have non-zero offsetWidth & zero
6639
					// getBoundingClientRect().width unless display is changed.
6640
					// Support: IE <=11 only
6641
					// Running getBoundingClientRect on a disconnected node
6642
					// in IE throws an error.
6643
					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6644
						swap( elem, cssShow, function() {
6645
							return getWidthOrHeight( elem, dimension, extra );
6646
						} ) :
6647
						getWidthOrHeight( elem, dimension, extra );
6648
			}
6649
		},
6650
6651
		set: function( elem, value, extra ) {
6652
			var matches,
6653
				styles = getStyles( elem ),
6654
				isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6655
				subtract = extra && boxModelAdjustment(
6656
					elem,
6657
					dimension,
6658
					extra,
6659
					isBorderBox,
6660
					styles
6661
				);
6662
6663
			// Account for unreliable border-box dimensions by comparing offset* to computed and
6664
			// faking a content-box to get border and padding (gh-3699)
6665
			if ( isBorderBox && support.scrollboxSize() === styles.position ) {
6666
				subtract -= Math.ceil(
6667
					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6668
					parseFloat( styles[ dimension ] ) -
6669
					boxModelAdjustment( elem, dimension, "border", false, styles ) -
6670
					0.5
6671
				);
6672
			}
6673
6674
			// Convert to pixels if value adjustment is needed
6675
			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6676
				( matches[ 3 ] || "px" ) !== "px" ) {
6677
6678
				elem.style[ dimension ] = value;
6679
				value = jQuery.css( elem, dimension );
6680
			}
6681
6682
			return setPositiveNumber( elem, value, subtract );
6683
		}
6684
	};
6685
} );
6686
6687
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6688
	function( elem, computed ) {
6689
		if ( computed ) {
6690
			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6691
				elem.getBoundingClientRect().left -
6692
					swap( elem, { marginLeft: 0 }, function() {
6693
						return elem.getBoundingClientRect().left;
6694
					} )
6695
				) + "px";
6696
		}
6697
	}
6698
);
6699
6700
// These hooks are used by animate to expand properties
6701
jQuery.each( {
6702
	margin: "",
6703
	padding: "",
6704
	border: "Width"
6705
}, function( prefix, suffix ) {
6706
	jQuery.cssHooks[ prefix + suffix ] = {
6707
		expand: function( value ) {
6708
			var i = 0,
6709
				expanded = {},
6710
6711
				// Assumes a single number if not a string
6712
				parts = typeof value === "string" ? value.split( " " ) : [ value ];
6713
6714
			for ( ; i < 4; i++ ) {
6715
				expanded[ prefix + cssExpand[ i ] + suffix ] =
6716
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6717
			}
6718
6719
			return expanded;
6720
		}
6721
	};
6722
6723
	if ( prefix !== "margin" ) {
6724
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6725
	}
6726
} );
6727
6728
jQuery.fn.extend( {
6729
	css: function( name, value ) {
6730
		return access( this, function( elem, name, value ) {
6731
			var styles, len,
6732
				map = {},
6733
				i = 0;
6734
6735
			if ( Array.isArray( name ) ) {
6736
				styles = getStyles( elem );
6737
				len = name.length;
6738
6739
				for ( ; i < len; i++ ) {
6740
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6741
				}
6742
6743
				return map;
6744
			}
6745
6746
			return value !== undefined ?
6747
				jQuery.style( elem, name, value ) :
6748
				jQuery.css( elem, name );
6749
		}, name, value, arguments.length > 1 );
6750
	}
6751
} );
6752
6753
6754
function Tween( elem, options, prop, end, easing ) {
6755
	return new Tween.prototype.init( elem, options, prop, end, easing );
6756
}
6757
jQuery.Tween = Tween;
6758
6759
Tween.prototype = {
6760
	constructor: Tween,
6761
	init: function( elem, options, prop, end, easing, unit ) {
6762
		this.elem = elem;
6763
		this.prop = prop;
6764
		this.easing = easing || jQuery.easing._default;
6765
		this.options = options;
6766
		this.start = this.now = this.cur();
6767
		this.end = end;
6768
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6769
	},
6770
	cur: function() {
6771
		var hooks = Tween.propHooks[ this.prop ];
6772
6773
		return hooks && hooks.get ?
6774
			hooks.get( this ) :
6775
			Tween.propHooks._default.get( this );
6776
	},
6777
	run: function( percent ) {
6778
		var eased,
6779
			hooks = Tween.propHooks[ this.prop ];
6780
6781
		if ( this.options.duration ) {
6782
			this.pos = eased = jQuery.easing[ this.easing ](
6783
				percent, this.options.duration * percent, 0, 1, this.options.duration
6784
			);
6785
		} else {
6786
			this.pos = eased = percent;
6787
		}
6788
		this.now = ( this.end - this.start ) * eased + this.start;
6789
6790
		if ( this.options.step ) {
6791
			this.options.step.call( this.elem, this.now, this );
6792
		}
6793
6794
		if ( hooks && hooks.set ) {
6795
			hooks.set( this );
6796
		} else {
6797
			Tween.propHooks._default.set( this );
6798
		}
6799
		return this;
6800
	}
6801
};
6802
6803
Tween.prototype.init.prototype = Tween.prototype;
6804
6805
Tween.propHooks = {
6806
	_default: {
6807
		get: function( tween ) {
6808
			var result;
6809
6810
			// Use a property on the element directly when it is not a DOM element,
6811
			// or when there is no matching style property that exists.
6812
			if ( tween.elem.nodeType !== 1 ||
6813
				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
6814
				return tween.elem[ tween.prop ];
6815
			}
6816
6817
			// Passing an empty string as a 3rd parameter to .css will automatically
6818
			// attempt a parseFloat and fallback to a string if the parse fails.
6819
			// Simple values such as "10px" are parsed to Float;
6820
			// complex values such as "rotate(1rad)" are returned as-is.
6821
			result = jQuery.css( tween.elem, tween.prop, "" );
6822
6823
			// Empty strings, null, undefined and "auto" are converted to 0.
6824
			return !result || result === "auto" ? 0 : result;
6825
		},
6826
		set: function( tween ) {
6827
6828
			// Use step hook for back compat.
6829
			// Use cssHook if its there.
6830
			// Use .style if available and use plain properties where available.
6831
			if ( jQuery.fx.step[ tween.prop ] ) {
6832
				jQuery.fx.step[ tween.prop ]( tween );
6833
			} else if ( tween.elem.nodeType === 1 &&
6834
				( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
6835
					jQuery.cssHooks[ tween.prop ] ) ) {
6836
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6837
			} else {
6838
				tween.elem[ tween.prop ] = tween.now;
6839
			}
6840
		}
6841
	}
6842
};
6843
6844
// Support: IE <=9 only
6845
// Panic based approach to setting things on disconnected nodes
6846
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6847
	set: function( tween ) {
6848
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
6849
			tween.elem[ tween.prop ] = tween.now;
6850
		}
6851
	}
6852
};
6853
6854
jQuery.easing = {
6855
	linear: function( p ) {
6856
		return p;
6857
	},
6858
	swing: function( p ) {
6859
		return 0.5 - Math.cos( p * Math.PI ) / 2;
6860
	},
6861
	_default: "swing"
6862
};
6863
6864
jQuery.fx = Tween.prototype.init;
6865
6866
// Back compat <1.8 extension point
6867
jQuery.fx.step = {};
6868
6869
6870
6871
6872
var
6873
	fxNow, inProgress,
6874
	rfxtypes = /^(?:toggle|show|hide)$/,
6875
	rrun = /queueHooks$/;
6876
6877
function schedule() {
6878
	if ( inProgress ) {
6879
		if ( document.hidden === false && window.requestAnimationFrame ) {
6880
			window.requestAnimationFrame( schedule );
6881
		} else {
6882
			window.setTimeout( schedule, jQuery.fx.interval );
6883
		}
6884
6885
		jQuery.fx.tick();
6886
	}
6887
}
6888
6889
// Animations created synchronously will run synchronously
6890
function createFxNow() {
6891
	window.setTimeout( function() {
6892
		fxNow = undefined;
6893
	} );
6894
	return ( fxNow = Date.now() );
6895
}
6896
6897
// Generate parameters to create a standard animation
6898
function genFx( type, includeWidth ) {
6899
	var which,
6900
		i = 0,
6901
		attrs = { height: type };
6902
6903
	// If we include width, step value is 1 to do all cssExpand values,
6904
	// otherwise step value is 2 to skip over Left and Right
6905
	includeWidth = includeWidth ? 1 : 0;
6906
	for ( ; i < 4; i += 2 - includeWidth ) {
6907
		which = cssExpand[ i ];
6908
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6909
	}
6910
6911
	if ( includeWidth ) {
6912
		attrs.opacity = attrs.width = type;
6913
	}
6914
6915
	return attrs;
6916
}
6917
6918
function createTween( value, prop, animation ) {
6919
	var tween,
6920
		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
6921
		index = 0,
6922
		length = collection.length;
6923
	for ( ; index < length; index++ ) {
6924
		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
6925
6926
			// We're done with this property
6927
			return tween;
6928
		}
6929
	}
6930
}
6931
6932
function defaultPrefilter( elem, props, opts ) {
6933
	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
6934
		isBox = "width" in props || "height" in props,
6935
		anim = this,
6936
		orig = {},
6937
		style = elem.style,
6938
		hidden = elem.nodeType && isHiddenWithinTree( elem ),
6939
		dataShow = dataPriv.get( elem, "fxshow" );
6940
6941
	// Queue-skipping animations hijack the fx hooks
6942
	if ( !opts.queue ) {
6943
		hooks = jQuery._queueHooks( elem, "fx" );
6944
		if ( hooks.unqueued == null ) {
6945
			hooks.unqueued = 0;
6946
			oldfire = hooks.empty.fire;
6947
			hooks.empty.fire = function() {
6948
				if ( !hooks.unqueued ) {
6949
					oldfire();
6950
				}
6951
			};
6952
		}
6953
		hooks.unqueued++;
6954
6955
		anim.always( function() {
6956
6957
			// Ensure the complete handler is called before this completes
6958
			anim.always( function() {
6959
				hooks.unqueued--;
6960
				if ( !jQuery.queue( elem, "fx" ).length ) {
6961
					hooks.empty.fire();
6962
				}
6963
			} );
6964
		} );
6965
	}
6966
6967
	// Detect show/hide animations
6968
	for ( prop in props ) {
6969
		value = props[ prop ];
6970
		if ( rfxtypes.test( value ) ) {
6971
			delete props[ prop ];
6972
			toggle = toggle || value === "toggle";
6973
			if ( value === ( hidden ? "hide" : "show" ) ) {
6974
6975
				// Pretend to be hidden if this is a "show" and
6976
				// there is still data from a stopped show/hide
6977
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6978
					hidden = true;
6979
6980
				// Ignore all other no-op show/hide data
6981
				} else {
6982
					continue;
6983
				}
6984
			}
6985
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6986
		}
6987
	}
6988
6989
	// Bail out if this is a no-op like .hide().hide()
6990
	propTween = !jQuery.isEmptyObject( props );
6991
	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
6992
		return;
6993
	}
6994
6995
	// Restrict "overflow" and "display" styles during box animations
6996
	if ( isBox && elem.nodeType === 1 ) {
6997
6998
		// Support: IE <=9 - 11, Edge 12 - 15
6999
		// Record all 3 overflow attributes because IE does not infer the shorthand
7000
		// from identically-valued overflowX and overflowY and Edge just mirrors
7001
		// the overflowX value there.
7002
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7003
7004
		// Identify a display type, preferring old show/hide data over the CSS cascade
7005
		restoreDisplay = dataShow && dataShow.display;
7006
		if ( restoreDisplay == null ) {
7007
			restoreDisplay = dataPriv.get( elem, "display" );
7008
		}
7009
		display = jQuery.css( elem, "display" );
7010
		if ( display === "none" ) {
7011
			if ( restoreDisplay ) {
7012
				display = restoreDisplay;
7013
			} else {
7014
7015
				// Get nonempty value(s) by temporarily forcing visibility
7016
				showHide( [ elem ], true );
7017
				restoreDisplay = elem.style.display || restoreDisplay;
7018
				display = jQuery.css( elem, "display" );
7019
				showHide( [ elem ] );
7020
			}
7021
		}
7022
7023
		// Animate inline elements as inline-block
7024
		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
7025
			if ( jQuery.css( elem, "float" ) === "none" ) {
7026
7027
				// Restore the original display value at the end of pure show/hide animations
7028
				if ( !propTween ) {
7029
					anim.done( function() {
7030
						style.display = restoreDisplay;
7031
					} );
7032
					if ( restoreDisplay == null ) {
7033
						display = style.display;
7034
						restoreDisplay = display === "none" ? "" : display;
7035
					}
7036
				}
7037
				style.display = "inline-block";
7038
			}
7039
		}
7040
	}
7041
7042
	if ( opts.overflow ) {
7043
		style.overflow = "hidden";
7044
		anim.always( function() {
7045
			style.overflow = opts.overflow[ 0 ];
7046
			style.overflowX = opts.overflow[ 1 ];
7047
			style.overflowY = opts.overflow[ 2 ];
7048
		} );
7049
	}
7050
7051
	// Implement show/hide animations
7052
	propTween = false;
7053
	for ( prop in orig ) {
7054
7055
		// General show/hide setup for this element animation
7056
		if ( !propTween ) {
7057
			if ( dataShow ) {
7058
				if ( "hidden" in dataShow ) {
7059
					hidden = dataShow.hidden;
7060
				}
7061
			} else {
7062
				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
7063
			}
7064
7065
			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
7066
			if ( toggle ) {
7067
				dataShow.hidden = !hidden;
7068
			}
7069
7070
			// Show elements before animating them
7071
			if ( hidden ) {
7072
				showHide( [ elem ], true );
7073
			}
7074
7075
			/* eslint-disable no-loop-func */
7076
7077
			anim.done( function() {
7078
7079
			/* eslint-enable no-loop-func */
7080
7081
				// The final step of a "hide" animation is actually hiding the element
7082
				if ( !hidden ) {
7083
					showHide( [ elem ] );
7084
				}
7085
				dataPriv.remove( elem, "fxshow" );
7086
				for ( prop in orig ) {
7087
					jQuery.style( elem, prop, orig[ prop ] );
7088
				}
7089
			} );
7090
		}
7091
7092
		// Per-property setup
7093
		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7094
		if ( !( prop in dataShow ) ) {
7095
			dataShow[ prop ] = propTween.start;
7096
			if ( hidden ) {
7097
				propTween.end = propTween.start;
7098
				propTween.start = 0;
7099
			}
7100
		}
7101
	}
7102
}
7103
7104
function propFilter( props, specialEasing ) {
7105
	var index, name, easing, value, hooks;
7106
7107
	// camelCase, specialEasing and expand cssHook pass
7108
	for ( index in props ) {
7109
		name = camelCase( index );
7110
		easing = specialEasing[ name ];
7111
		value = props[ index ];
7112
		if ( Array.isArray( value ) ) {
7113
			easing = value[ 1 ];
7114
			value = props[ index ] = value[ 0 ];
7115
		}
7116
7117
		if ( index !== name ) {
7118
			props[ name ] = value;
7119
			delete props[ index ];
7120
		}
7121
7122
		hooks = jQuery.cssHooks[ name ];
7123
		if ( hooks && "expand" in hooks ) {
7124
			value = hooks.expand( value );
7125
			delete props[ name ];
7126
7127
			// Not quite $.extend, this won't overwrite existing keys.
7128
			// Reusing 'index' because we have the correct "name"
7129
			for ( index in value ) {
7130
				if ( !( index in props ) ) {
7131
					props[ index ] = value[ index ];
7132
					specialEasing[ index ] = easing;
7133
				}
7134
			}
7135
		} else {
7136
			specialEasing[ name ] = easing;
7137
		}
7138
	}
7139
}
7140
7141
function Animation( elem, properties, options ) {
7142
	var result,
7143
		stopped,
7144
		index = 0,
7145
		length = Animation.prefilters.length,
7146
		deferred = jQuery.Deferred().always( function() {
7147
7148
			// Don't match elem in the :animated selector
7149
			delete tick.elem;
7150
		} ),
7151
		tick = function() {
7152
			if ( stopped ) {
7153
				return false;
7154
			}
7155
			var currentTime = fxNow || createFxNow(),
7156
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7157
7158
				// Support: Android 2.3 only
7159
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
7160
				temp = remaining / animation.duration || 0,
7161
				percent = 1 - temp,
7162
				index = 0,
7163
				length = animation.tweens.length;
7164
7165
			for ( ; index < length; index++ ) {
7166
				animation.tweens[ index ].run( percent );
7167
			}
7168
7169
			deferred.notifyWith( elem, [ animation, percent, remaining ] );
7170
7171
			// If there's more to do, yield
7172
			if ( percent < 1 && length ) {
7173
				return remaining;
7174
			}
7175
7176
			// If this was an empty animation, synthesize a final progress notification
7177
			if ( !length ) {
7178
				deferred.notifyWith( elem, [ animation, 1, 0 ] );
7179
			}
7180
7181
			// Resolve the animation and report its conclusion
7182
			deferred.resolveWith( elem, [ animation ] );
7183
			return false;
7184
		},
7185
		animation = deferred.promise( {
7186
			elem: elem,
7187
			props: jQuery.extend( {}, properties ),
7188
			opts: jQuery.extend( true, {
7189
				specialEasing: {},
7190
				easing: jQuery.easing._default
7191
			}, options ),
7192
			originalProperties: properties,
7193
			originalOptions: options,
7194
			startTime: fxNow || createFxNow(),
7195
			duration: options.duration,
7196
			tweens: [],
7197
			createTween: function( prop, end ) {
7198
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
7199
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
7200
				animation.tweens.push( tween );
7201
				return tween;
7202
			},
7203
			stop: function( gotoEnd ) {
7204
				var index = 0,
7205
7206
					// If we are going to the end, we want to run all the tweens
7207
					// otherwise we skip this part
7208
					length = gotoEnd ? animation.tweens.length : 0;
7209
				if ( stopped ) {
7210
					return this;
7211
				}
7212
				stopped = true;
7213
				for ( ; index < length; index++ ) {
7214
					animation.tweens[ index ].run( 1 );
7215
				}
7216
7217
				// Resolve when we played the last frame; otherwise, reject
7218
				if ( gotoEnd ) {
7219
					deferred.notifyWith( elem, [ animation, 1, 0 ] );
7220
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
7221
				} else {
7222
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
7223
				}
7224
				return this;
7225
			}
7226
		} ),
7227
		props = animation.props;
7228
7229
	propFilter( props, animation.opts.specialEasing );
7230
7231
	for ( ; index < length; index++ ) {
7232
		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7233
		if ( result ) {
7234
			if ( isFunction( result.stop ) ) {
7235
				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7236
					result.stop.bind( result );
7237
			}
7238
			return result;
7239
		}
7240
	}
7241
7242
	jQuery.map( props, createTween, animation );
7243
7244
	if ( isFunction( animation.opts.start ) ) {
7245
		animation.opts.start.call( elem, animation );
7246
	}
7247
7248
	// Attach callbacks from options
7249
	animation
7250
		.progress( animation.opts.progress )
7251
		.done( animation.opts.done, animation.opts.complete )
7252
		.fail( animation.opts.fail )
7253
		.always( animation.opts.always );
7254
7255
	jQuery.fx.timer(
7256
		jQuery.extend( tick, {
7257
			elem: elem,
7258
			anim: animation,
7259
			queue: animation.opts.queue
7260
		} )
7261
	);
7262
7263
	return animation;
7264
}
7265
7266
jQuery.Animation = jQuery.extend( Animation, {
7267
7268
	tweeners: {
7269
		"*": [ function( prop, value ) {
7270
			var tween = this.createTween( prop, value );
7271
			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7272
			return tween;
7273
		} ]
7274
	},
7275
7276
	tweener: function( props, callback ) {
7277
		if ( isFunction( props ) ) {
7278
			callback = props;
7279
			props = [ "*" ];
7280
		} else {
7281
			props = props.match( rnothtmlwhite );
7282
		}
7283
7284
		var prop,
7285
			index = 0,
7286
			length = props.length;
7287
7288
		for ( ; index < length; index++ ) {
7289
			prop = props[ index ];
7290
			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7291
			Animation.tweeners[ prop ].unshift( callback );
7292
		}
7293
	},
7294
7295
	prefilters: [ defaultPrefilter ],
7296
7297
	prefilter: function( callback, prepend ) {
7298
		if ( prepend ) {
7299
			Animation.prefilters.unshift( callback );
7300
		} else {
7301
			Animation.prefilters.push( callback );
7302
		}
7303
	}
7304
} );
7305
7306
jQuery.speed = function( speed, easing, fn ) {
7307
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7308
		complete: fn || !fn && easing ||
7309
			isFunction( speed ) && speed,
7310
		duration: speed,
7311
		easing: fn && easing || easing && !isFunction( easing ) && easing
7312
	};
7313
7314
	// Go to the end state if fx are off
7315
	if ( jQuery.fx.off ) {
7316
		opt.duration = 0;
7317
7318
	} else {
7319
		if ( typeof opt.duration !== "number" ) {
7320
			if ( opt.duration in jQuery.fx.speeds ) {
7321
				opt.duration = jQuery.fx.speeds[ opt.duration ];
7322
7323
			} else {
7324
				opt.duration = jQuery.fx.speeds._default;
7325
			}
7326
		}
7327
	}
7328
7329
	// Normalize opt.queue - true/undefined/null -> "fx"
7330
	if ( opt.queue == null || opt.queue === true ) {
7331
		opt.queue = "fx";
7332
	}
7333
7334
	// Queueing
7335
	opt.old = opt.complete;
7336
7337
	opt.complete = function() {
7338
		if ( isFunction( opt.old ) ) {
7339
			opt.old.call( this );
7340
		}
7341
7342
		if ( opt.queue ) {
7343
			jQuery.dequeue( this, opt.queue );
7344
		}
7345
	};
7346
7347
	return opt;
7348
};
7349
7350
jQuery.fn.extend( {
7351
	fadeTo: function( speed, to, easing, callback ) {
7352
7353
		// Show any hidden elements after setting opacity to 0
7354
		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7355
7356
			// Animate to the value specified
7357
			.end().animate( { opacity: to }, speed, easing, callback );
7358
	},
7359
	animate: function( prop, speed, easing, callback ) {
7360
		var empty = jQuery.isEmptyObject( prop ),
7361
			optall = jQuery.speed( speed, easing, callback ),
7362
			doAnimation = function() {
7363
7364
				// Operate on a copy of prop so per-property easing won't be lost
7365
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7366
7367
				// Empty animations, or finishing resolves immediately
7368
				if ( empty || dataPriv.get( this, "finish" ) ) {
7369
					anim.stop( true );
7370
				}
7371
			};
7372
			doAnimation.finish = doAnimation;
7373
7374
		return empty || optall.queue === false ?
7375
			this.each( doAnimation ) :
7376
			this.queue( optall.queue, doAnimation );
7377
	},
7378
	stop: function( type, clearQueue, gotoEnd ) {
7379
		var stopQueue = function( hooks ) {
7380
			var stop = hooks.stop;
7381
			delete hooks.stop;
7382
			stop( gotoEnd );
7383
		};
7384
7385
		if ( typeof type !== "string" ) {
7386
			gotoEnd = clearQueue;
7387
			clearQueue = type;
7388
			type = undefined;
7389
		}
7390
		if ( clearQueue && type !== false ) {
7391
			this.queue( type || "fx", [] );
7392
		}
7393
7394
		return this.each( function() {
7395
			var dequeue = true,
7396
				index = type != null && type + "queueHooks",
7397
				timers = jQuery.timers,
7398
				data = dataPriv.get( this );
7399
7400
			if ( index ) {
7401
				if ( data[ index ] && data[ index ].stop ) {
7402
					stopQueue( data[ index ] );
7403
				}
7404
			} else {
7405
				for ( index in data ) {
7406
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7407
						stopQueue( data[ index ] );
7408
					}
7409
				}
7410
			}
7411
7412
			for ( index = timers.length; index--; ) {
7413
				if ( timers[ index ].elem === this &&
7414
					( type == null || timers[ index ].queue === type ) ) {
7415
7416
					timers[ index ].anim.stop( gotoEnd );
7417
					dequeue = false;
7418
					timers.splice( index, 1 );
7419
				}
7420
			}
7421
7422
			// Start the next in the queue if the last step wasn't forced.
7423
			// Timers currently will call their complete callbacks, which
7424
			// will dequeue but only if they were gotoEnd.
7425
			if ( dequeue || !gotoEnd ) {
7426
				jQuery.dequeue( this, type );
7427
			}
7428
		} );
7429
	},
7430
	finish: function( type ) {
7431
		if ( type !== false ) {
7432
			type = type || "fx";
7433
		}
7434
		return this.each( function() {
7435
			var index,
7436
				data = dataPriv.get( this ),
7437
				queue = data[ type + "queue" ],
7438
				hooks = data[ type + "queueHooks" ],
7439
				timers = jQuery.timers,
7440
				length = queue ? queue.length : 0;
7441
7442
			// Enable finishing flag on private data
7443
			data.finish = true;
7444
7445
			// Empty the queue first
7446
			jQuery.queue( this, type, [] );
7447
7448
			if ( hooks && hooks.stop ) {
7449
				hooks.stop.call( this, true );
7450
			}
7451
7452
			// Look for any active animations, and finish them
7453
			for ( index = timers.length; index--; ) {
7454
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7455
					timers[ index ].anim.stop( true );
7456
					timers.splice( index, 1 );
7457
				}
7458
			}
7459
7460
			// Look for any animations in the old queue and finish them
7461
			for ( index = 0; index < length; index++ ) {
7462
				if ( queue[ index ] && queue[ index ].finish ) {
7463
					queue[ index ].finish.call( this );
7464
				}
7465
			}
7466
7467
			// Turn off finishing flag
7468
			delete data.finish;
7469
		} );
7470
	}
7471
} );
7472
7473
jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7474
	var cssFn = jQuery.fn[ name ];
7475
	jQuery.fn[ name ] = function( speed, easing, callback ) {
7476
		return speed == null || typeof speed === "boolean" ?
7477
			cssFn.apply( this, arguments ) :
7478
			this.animate( genFx( name, true ), speed, easing, callback );
7479
	};
7480
} );
7481
7482
// Generate shortcuts for custom animations
7483
jQuery.each( {
7484
	slideDown: genFx( "show" ),
7485
	slideUp: genFx( "hide" ),
7486
	slideToggle: genFx( "toggle" ),
7487
	fadeIn: { opacity: "show" },
7488
	fadeOut: { opacity: "hide" },
7489
	fadeToggle: { opacity: "toggle" }
7490
}, function( name, props ) {
7491
	jQuery.fn[ name ] = function( speed, easing, callback ) {
7492
		return this.animate( props, speed, easing, callback );
7493
	};
7494
} );
7495
7496
jQuery.timers = [];
7497
jQuery.fx.tick = function() {
7498
	var timer,
7499
		i = 0,
7500
		timers = jQuery.timers;
7501
7502
	fxNow = Date.now();
7503
7504
	for ( ; i < timers.length; i++ ) {
7505
		timer = timers[ i ];
7506
7507
		// Run the timer and safely remove it when done (allowing for external removal)
7508
		if ( !timer() && timers[ i ] === timer ) {
7509
			timers.splice( i--, 1 );
7510
		}
7511
	}
7512
7513
	if ( !timers.length ) {
7514
		jQuery.fx.stop();
7515
	}
7516
	fxNow = undefined;
7517
};
7518
7519
jQuery.fx.timer = function( timer ) {
7520
	jQuery.timers.push( timer );
7521
	jQuery.fx.start();
7522
};
7523
7524
jQuery.fx.interval = 13;
7525
jQuery.fx.start = function() {
7526
	if ( inProgress ) {
7527
		return;
7528
	}
7529
7530
	inProgress = true;
7531
	schedule();
7532
};
7533
7534
jQuery.fx.stop = function() {
7535
	inProgress = null;
7536
};
7537
7538
jQuery.fx.speeds = {
7539
	slow: 600,
7540
	fast: 200,
7541
7542
	// Default speed
7543
	_default: 400
7544
};
7545
7546
7547
// Based off of the plugin by Clint Helfers, with permission.
7548
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7549
jQuery.fn.delay = function( time, type ) {
7550
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7551
	type = type || "fx";
7552
7553
	return this.queue( type, function( next, hooks ) {
7554
		var timeout = window.setTimeout( next, time );
7555
		hooks.stop = function() {
7556
			window.clearTimeout( timeout );
7557
		};
7558
	} );
7559
};
7560
7561
7562
( function() {
7563
	var input = document.createElement( "input" ),
7564
		select = document.createElement( "select" ),
7565
		opt = select.appendChild( document.createElement( "option" ) );
7566
7567
	input.type = "checkbox";
7568
7569
	// Support: Android <=4.3 only
7570
	// Default value for a checkbox should be "on"
7571
	support.checkOn = input.value !== "";
7572
7573
	// Support: IE <=11 only
7574
	// Must access selectedIndex to make default options select
7575
	support.optSelected = opt.selected;
7576
7577
	// Support: IE <=11 only
7578
	// An input loses its value after becoming a radio
7579
	input = document.createElement( "input" );
7580
	input.value = "t";
7581
	input.type = "radio";
7582
	support.radioValue = input.value === "t";
7583
} )();
7584
7585
7586
var boolHook,
7587
	attrHandle = jQuery.expr.attrHandle;
7588
7589
jQuery.fn.extend( {
7590
	attr: function( name, value ) {
7591
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
7592
	},
7593
7594
	removeAttr: function( name ) {
7595
		return this.each( function() {
7596
			jQuery.removeAttr( this, name );
7597
		} );
7598
	}
7599
} );
7600
7601
jQuery.extend( {
7602
	attr: function( elem, name, value ) {
7603
		var ret, hooks,
7604
			nType = elem.nodeType;
7605
7606
		// Don't get/set attributes on text, comment and attribute nodes
7607
		if ( nType === 3 || nType === 8 || nType === 2 ) {
7608
			return;
7609
		}
7610
7611
		// Fallback to prop when attributes are not supported
7612
		if ( typeof elem.getAttribute === "undefined" ) {
7613
			return jQuery.prop( elem, name, value );
7614
		}
7615
7616
		// Attribute hooks are determined by the lowercase version
7617
		// Grab necessary hook if one is defined
7618
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7619
			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7620
				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7621
		}
7622
7623
		if ( value !== undefined ) {
7624
			if ( value === null ) {
7625
				jQuery.removeAttr( elem, name );
7626
				return;
7627
			}
7628
7629
			if ( hooks && "set" in hooks &&
7630
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7631
				return ret;
7632
			}
7633
7634
			elem.setAttribute( name, value + "" );
7635
			return value;
7636
		}
7637
7638
		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7639
			return ret;
7640
		}
7641
7642
		ret = jQuery.find.attr( elem, name );
7643
7644
		// Non-existent attributes return null, we normalize to undefined
7645
		return ret == null ? undefined : ret;
7646
	},
7647
7648
	attrHooks: {
7649
		type: {
7650
			set: function( elem, value ) {
7651
				if ( !support.radioValue && value === "radio" &&
7652
					nodeName( elem, "input" ) ) {
7653
					var val = elem.value;
7654
					elem.setAttribute( "type", value );
7655
					if ( val ) {
7656
						elem.value = val;
7657
					}
7658
					return value;
7659
				}
7660
			}
7661
		}
7662
	},
7663
7664
	removeAttr: function( elem, value ) {
7665
		var name,
7666
			i = 0,
7667
7668
			// Attribute names can contain non-HTML whitespace characters
7669
			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7670
			attrNames = value && value.match( rnothtmlwhite );
7671
7672
		if ( attrNames && elem.nodeType === 1 ) {
7673
			while ( ( name = attrNames[ i++ ] ) ) {
7674
				elem.removeAttribute( name );
7675
			}
7676
		}
7677
	}
7678
} );
7679
7680
// Hooks for boolean attributes
7681
boolHook = {
7682
	set: function( elem, value, name ) {
7683
		if ( value === false ) {
7684
7685
			// Remove boolean attributes when set to false
7686
			jQuery.removeAttr( elem, name );
7687
		} else {
7688
			elem.setAttribute( name, name );
7689
		}
7690
		return name;
7691
	}
7692
};
7693
7694
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7695
	var getter = attrHandle[ name ] || jQuery.find.attr;
7696
7697
	attrHandle[ name ] = function( elem, name, isXML ) {
7698
		var ret, handle,
7699
			lowercaseName = name.toLowerCase();
7700
7701
		if ( !isXML ) {
7702
7703
			// Avoid an infinite loop by temporarily removing this function from the getter
7704
			handle = attrHandle[ lowercaseName ];
7705
			attrHandle[ lowercaseName ] = ret;
7706
			ret = getter( elem, name, isXML ) != null ?
7707
				lowercaseName :
7708
				null;
7709
			attrHandle[ lowercaseName ] = handle;
7710
		}
7711
		return ret;
7712
	};
7713
} );
7714
7715
7716
7717
7718
var rfocusable = /^(?:input|select|textarea|button)$/i,
7719
	rclickable = /^(?:a|area)$/i;
7720
7721
jQuery.fn.extend( {
7722
	prop: function( name, value ) {
7723
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
7724
	},
7725
7726
	removeProp: function( name ) {
7727
		return this.each( function() {
7728
			delete this[ jQuery.propFix[ name ] || name ];
7729
		} );
7730
	}
7731
} );
7732
7733
jQuery.extend( {
7734
	prop: function( elem, name, value ) {
7735
		var ret, hooks,
7736
			nType = elem.nodeType;
7737
7738
		// Don't get/set properties on text, comment and attribute nodes
7739
		if ( nType === 3 || nType === 8 || nType === 2 ) {
7740
			return;
7741
		}
7742
7743
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7744
7745
			// Fix name and attach hooks
7746
			name = jQuery.propFix[ name ] || name;
7747
			hooks = jQuery.propHooks[ name ];
7748
		}
7749
7750
		if ( value !== undefined ) {
7751
			if ( hooks && "set" in hooks &&
7752
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7753
				return ret;
7754
			}
7755
7756
			return ( elem[ name ] = value );
7757
		}
7758
7759
		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7760
			return ret;
7761
		}
7762
7763
		return elem[ name ];
7764
	},
7765
7766
	propHooks: {
7767
		tabIndex: {
7768
			get: function( elem ) {
7769
7770
				// Support: IE <=9 - 11 only
7771
				// elem.tabIndex doesn't always return the
7772
				// correct value when it hasn't been explicitly set
7773
				// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
7774
				// Use proper attribute retrieval(#12072)
7775
				var tabindex = jQuery.find.attr( elem, "tabindex" );
7776
7777
				if ( tabindex ) {
7778
					return parseInt( tabindex, 10 );
7779
				}
7780
7781
				if (
7782
					rfocusable.test( elem.nodeName ) ||
7783
					rclickable.test( elem.nodeName ) &&
7784
					elem.href
7785
				) {
7786
					return 0;
7787
				}
7788
7789
				return -1;
7790
			}
7791
		}
7792
	},
7793
7794
	propFix: {
7795
		"for": "htmlFor",
7796
		"class": "className"
7797
	}
7798
} );
7799
7800
// Support: IE <=11 only
7801
// Accessing the selectedIndex property
7802
// forces the browser to respect setting selected
7803
// on the option
7804
// The getter ensures a default option is selected
7805
// when in an optgroup
7806
// eslint rule "no-unused-expressions" is disabled for this code
7807
// since it considers such accessions noop
7808
if ( !support.optSelected ) {
7809
	jQuery.propHooks.selected = {
7810
		get: function( elem ) {
7811
7812
			/* eslint no-unused-expressions: "off" */
7813
7814
			var parent = elem.parentNode;
7815
			if ( parent && parent.parentNode ) {
7816
				parent.parentNode.selectedIndex;
7817
			}
7818
			return null;
7819
		},
7820
		set: function( elem ) {
7821
7822
			/* eslint no-unused-expressions: "off" */
7823
7824
			var parent = elem.parentNode;
7825
			if ( parent ) {
7826
				parent.selectedIndex;
7827
7828
				if ( parent.parentNode ) {
7829
					parent.parentNode.selectedIndex;
7830
				}
7831
			}
7832
		}
7833
	};
7834
}
7835
7836
jQuery.each( [
7837
	"tabIndex",
7838
	"readOnly",
7839
	"maxLength",
7840
	"cellSpacing",
7841
	"cellPadding",
7842
	"rowSpan",
7843
	"colSpan",
7844
	"useMap",
7845
	"frameBorder",
7846
	"contentEditable"
7847
], function() {
7848
	jQuery.propFix[ this.toLowerCase() ] = this;
7849
} );
7850
7851
7852
7853
7854
	// Strip and collapse whitespace according to HTML spec
7855
	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
7856
	function stripAndCollapse( value ) {
7857
		var tokens = value.match( rnothtmlwhite ) || [];
7858
		return tokens.join( " " );
7859
	}
7860
7861
7862
function getClass( elem ) {
7863
	return elem.getAttribute && elem.getAttribute( "class" ) || "";
7864
}
7865
7866
function classesToArray( value ) {
7867
	if ( Array.isArray( value ) ) {
7868
		return value;
7869
	}
7870
	if ( typeof value === "string" ) {
7871
		return value.match( rnothtmlwhite ) || [];
7872
	}
7873
	return [];
7874
}
7875
7876
jQuery.fn.extend( {
7877
	addClass: function( value ) {
7878
		var classes, elem, cur, curValue, clazz, j, finalValue,
7879
			i = 0;
7880
7881
		if ( isFunction( value ) ) {
7882
			return this.each( function( j ) {
7883
				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7884
			} );
7885
		}
7886
7887
		classes = classesToArray( value );
7888
7889
		if ( classes.length ) {
7890
			while ( ( elem = this[ i++ ] ) ) {
7891
				curValue = getClass( elem );
7892
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7893
7894
				if ( cur ) {
7895
					j = 0;
7896
					while ( ( clazz = classes[ j++ ] ) ) {
7897
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7898
							cur += clazz + " ";
7899
						}
7900
					}
7901
7902
					// Only assign if different to avoid unneeded rendering.
7903
					finalValue = stripAndCollapse( cur );
7904
					if ( curValue !== finalValue ) {
7905
						elem.setAttribute( "class", finalValue );
7906
					}
7907
				}
7908
			}
7909
		}
7910
7911
		return this;
7912
	},
7913
7914
	removeClass: function( value ) {
7915
		var classes, elem, cur, curValue, clazz, j, finalValue,
7916
			i = 0;
7917
7918
		if ( isFunction( value ) ) {
7919
			return this.each( function( j ) {
7920
				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7921
			} );
7922
		}
7923
7924
		if ( !arguments.length ) {
7925
			return this.attr( "class", "" );
7926
		}
7927
7928
		classes = classesToArray( value );
7929
7930
		if ( classes.length ) {
7931
			while ( ( elem = this[ i++ ] ) ) {
7932
				curValue = getClass( elem );
7933
7934
				// This expression is here for better compressibility (see addClass)
7935
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7936
7937
				if ( cur ) {
7938
					j = 0;
7939
					while ( ( clazz = classes[ j++ ] ) ) {
7940
7941
						// Remove *all* instances
7942
						while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
7943
							cur = cur.replace( " " + clazz + " ", " " );
7944
						}
7945
					}
7946
7947
					// Only assign if different to avoid unneeded rendering.
7948
					finalValue = stripAndCollapse( cur );
7949
					if ( curValue !== finalValue ) {
7950
						elem.setAttribute( "class", finalValue );
7951
					}
7952
				}
7953
			}
7954
		}
7955
7956
		return this;
7957
	},
7958
7959
	toggleClass: function( value, stateVal ) {
7960
		var type = typeof value,
7961
			isValidValue = type === "string" || Array.isArray( value );
7962
7963
		if ( typeof stateVal === "boolean" && isValidValue ) {
7964
			return stateVal ? this.addClass( value ) : this.removeClass( value );
7965
		}
7966
7967
		if ( isFunction( value ) ) {
7968
			return this.each( function( i ) {
7969
				jQuery( this ).toggleClass(
7970
					value.call( this, i, getClass( this ), stateVal ),
7971
					stateVal
7972
				);
7973
			} );
7974
		}
7975
7976
		return this.each( function() {
7977
			var className, i, self, classNames;
7978
7979
			if ( isValidValue ) {
7980
7981
				// Toggle individual class names
7982
				i = 0;
7983
				self = jQuery( this );
7984
				classNames = classesToArray( value );
7985
7986
				while ( ( className = classNames[ i++ ] ) ) {
7987
7988
					// Check each className given, space separated list
7989
					if ( self.hasClass( className ) ) {
7990
						self.removeClass( className );
7991
					} else {
7992
						self.addClass( className );
7993
					}
7994
				}
7995
7996
			// Toggle whole class name
7997
			} else if ( value === undefined || type === "boolean" ) {
7998
				className = getClass( this );
7999
				if ( className ) {
8000
8001
					// Store className if set
8002
					dataPriv.set( this, "__className__", className );
8003
				}
8004
8005
				// If the element has a class name or if we're passed `false`,
8006
				// then remove the whole classname (if there was one, the above saved it).
8007
				// Otherwise bring back whatever was previously saved (if anything),
8008
				// falling back to the empty string if nothing was stored.
8009
				if ( this.setAttribute ) {
8010
					this.setAttribute( "class",
8011
						className || value === false ?
8012
						"" :
8013
						dataPriv.get( this, "__className__" ) || ""
8014
					);
8015
				}
8016
			}
8017
		} );
8018
	},
8019
8020
	hasClass: function( selector ) {
8021
		var className, elem,
8022
			i = 0;
8023
8024
		className = " " + selector + " ";
8025
		while ( ( elem = this[ i++ ] ) ) {
8026
			if ( elem.nodeType === 1 &&
8027
				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
8028
					return true;
8029
			}
8030
		}
8031
8032
		return false;
8033
	}
8034
} );
8035
8036
8037
8038
8039
var rreturn = /\r/g;
8040
8041
jQuery.fn.extend( {
8042
	val: function( value ) {
8043
		var hooks, ret, valueIsFunction,
8044
			elem = this[ 0 ];
8045
8046
		if ( !arguments.length ) {
8047
			if ( elem ) {
8048
				hooks = jQuery.valHooks[ elem.type ] ||
8049
					jQuery.valHooks[ elem.nodeName.toLowerCase() ];
8050
8051
				if ( hooks &&
8052
					"get" in hooks &&
8053
					( ret = hooks.get( elem, "value" ) ) !== undefined
8054
				) {
8055
					return ret;
8056
				}
8057
8058
				ret = elem.value;
8059
8060
				// Handle most common string cases
8061
				if ( typeof ret === "string" ) {
8062
					return ret.replace( rreturn, "" );
8063
				}
8064
8065
				// Handle cases where value is null/undef or number
8066
				return ret == null ? "" : ret;
8067
			}
8068
8069
			return;
8070
		}
8071
8072
		valueIsFunction = isFunction( value );
8073
8074
		return this.each( function( i ) {
8075
			var val;
8076
8077
			if ( this.nodeType !== 1 ) {
8078
				return;
8079
			}
8080
8081
			if ( valueIsFunction ) {
8082
				val = value.call( this, i, jQuery( this ).val() );
8083
			} else {
8084
				val = value;
8085
			}
8086
8087
			// Treat null/undefined as ""; convert numbers to string
8088
			if ( val == null ) {
8089
				val = "";
8090
8091
			} else if ( typeof val === "number" ) {
8092
				val += "";
8093
8094
			} else if ( Array.isArray( val ) ) {
8095
				val = jQuery.map( val, function( value ) {
8096
					return value == null ? "" : value + "";
8097
				} );
8098
			}
8099
8100
			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
8101
8102
			// If set returns undefined, fall back to normal setting
8103
			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
8104
				this.value = val;
8105
			}
8106
		} );
8107
	}
8108
} );
8109
8110
jQuery.extend( {
8111
	valHooks: {
8112
		option: {
8113
			get: function( elem ) {
8114
8115
				var val = jQuery.find.attr( elem, "value" );
8116
				return val != null ?
8117
					val :
8118
8119
					// Support: IE <=10 - 11 only
8120
					// option.text throws exceptions (#14686, #14858)
8121
					// Strip and collapse whitespace
8122
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8123
					stripAndCollapse( jQuery.text( elem ) );
8124
			}
8125
		},
8126
		select: {
8127
			get: function( elem ) {
8128
				var value, option, i,
8129
					options = elem.options,
8130
					index = elem.selectedIndex,
8131
					one = elem.type === "select-one",
8132
					values = one ? null : [],
8133
					max = one ? index + 1 : options.length;
8134
8135
				if ( index < 0 ) {
8136
					i = max;
8137
8138
				} else {
8139
					i = one ? index : 0;
8140
				}
8141
8142
				// Loop through all the selected options
8143
				for ( ; i < max; i++ ) {
8144
					option = options[ i ];
8145
8146
					// Support: IE <=9 only
8147
					// IE8-9 doesn't update selected after form reset (#2551)
8148
					if ( ( option.selected || i === index ) &&
8149
8150
							// Don't return options that are disabled or in a disabled optgroup
8151
							!option.disabled &&
8152
							( !option.parentNode.disabled ||
8153
								!nodeName( option.parentNode, "optgroup" ) ) ) {
8154
8155
						// Get the specific value for the option
8156
						value = jQuery( option ).val();
8157
8158
						// We don't need an array for one selects
8159
						if ( one ) {
8160
							return value;
8161
						}
8162
8163
						// Multi-Selects return an array
8164
						values.push( value );
8165
					}
8166
				}
8167
8168
				return values;
8169
			},
8170
8171
			set: function( elem, value ) {
8172
				var optionSet, option,
8173
					options = elem.options,
8174
					values = jQuery.makeArray( value ),
8175
					i = options.length;
8176
8177
				while ( i-- ) {
8178
					option = options[ i ];
8179
8180
					/* eslint-disable no-cond-assign */
8181
8182
					if ( option.selected =
8183
						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8184
					) {
8185
						optionSet = true;
8186
					}
8187
8188
					/* eslint-enable no-cond-assign */
8189
				}
8190
8191
				// Force browsers to behave consistently when non-matching value is set
8192
				if ( !optionSet ) {
8193
					elem.selectedIndex = -1;
8194
				}
8195
				return values;
8196
			}
8197
		}
8198
	}
8199
} );
8200
8201
// Radios and checkboxes getter/setter
8202
jQuery.each( [ "radio", "checkbox" ], function() {
8203
	jQuery.valHooks[ this ] = {
8204
		set: function( elem, value ) {
8205
			if ( Array.isArray( value ) ) {
8206
				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8207
			}
8208
		}
8209
	};
8210
	if ( !support.checkOn ) {
8211
		jQuery.valHooks[ this ].get = function( elem ) {
8212
			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8213
		};
8214
	}
8215
} );
8216
8217
8218
8219
8220
// Return jQuery for attributes-only inclusion
8221
8222
8223
support.focusin = "onfocusin" in window;
8224
8225
8226
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8227
	stopPropagationCallback = function( e ) {
8228
		e.stopPropagation();
8229
	};
8230
8231
jQuery.extend( jQuery.event, {
8232
8233
	trigger: function( event, data, elem, onlyHandlers ) {
8234
8235
		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
8236
			eventPath = [ elem || document ],
8237
			type = hasOwn.call( event, "type" ) ? event.type : event,
8238
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8239
8240
		cur = lastElement = tmp = elem = elem || document;
8241
8242
		// Don't do events on text and comment nodes
8243
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8244
			return;
8245
		}
8246
8247
		// focus/blur morphs to focusin/out; ensure we're not firing them right now
8248
		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8249
			return;
8250
		}
8251
8252
		if ( type.indexOf( "." ) > -1 ) {
8253
8254
			// Namespaced trigger; create a regexp to match event type in handle()
8255
			namespaces = type.split( "." );
8256
			type = namespaces.shift();
8257
			namespaces.sort();
8258
		}
8259
		ontype = type.indexOf( ":" ) < 0 && "on" + type;
8260
8261
		// Caller can pass in a jQuery.Event object, Object, or just an event type string
8262
		event = event[ jQuery.expando ] ?
8263
			event :
8264
			new jQuery.Event( type, typeof event === "object" && event );
8265
8266
		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8267
		event.isTrigger = onlyHandlers ? 2 : 3;
8268
		event.namespace = namespaces.join( "." );
8269
		event.rnamespace = event.namespace ?
8270
			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8271
			null;
8272
8273
		// Clean up the event in case it is being reused
8274
		event.result = undefined;
8275
		if ( !event.target ) {
8276
			event.target = elem;
8277
		}
8278
8279
		// Clone any incoming data and prepend the event, creating the handler arg list
8280
		data = data == null ?
8281
			[ event ] :
8282
			jQuery.makeArray( data, [ event ] );
8283
8284
		// Allow special events to draw outside the lines
8285
		special = jQuery.event.special[ type ] || {};
8286
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8287
			return;
8288
		}
8289
8290
		// Determine event propagation path in advance, per W3C events spec (#9951)
8291
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8292
		if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8293
8294
			bubbleType = special.delegateType || type;
8295
			if ( !rfocusMorph.test( bubbleType + type ) ) {
8296
				cur = cur.parentNode;
8297
			}
8298
			for ( ; cur; cur = cur.parentNode ) {
8299
				eventPath.push( cur );
8300
				tmp = cur;
8301
			}
8302
8303
			// Only add window if we got to document (e.g., not plain obj or detached DOM)
8304
			if ( tmp === ( elem.ownerDocument || document ) ) {
8305
				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8306
			}
8307
		}
8308
8309
		// Fire handlers on the event path
8310
		i = 0;
8311
		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8312
			lastElement = cur;
8313
			event.type = i > 1 ?
8314
				bubbleType :
8315
				special.bindType || type;
8316
8317
			// jQuery handler
8318
			handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8319
				dataPriv.get( cur, "handle" );
8320
			if ( handle ) {
8321
				handle.apply( cur, data );
8322
			}
8323
8324
			// Native handler
8325
			handle = ontype && cur[ ontype ];
8326
			if ( handle && handle.apply && acceptData( cur ) ) {
8327
				event.result = handle.apply( cur, data );
8328
				if ( event.result === false ) {
8329
					event.preventDefault();
8330
				}
8331
			}
8332
		}
8333
		event.type = type;
8334
8335
		// If nobody prevented the default action, do it now
8336
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8337
8338
			if ( ( !special._default ||
8339
				special._default.apply( eventPath.pop(), data ) === false ) &&
8340
				acceptData( elem ) ) {
8341
8342
				// Call a native DOM method on the target with the same name as the event.
8343
				// Don't do default actions on window, that's where global variables be (#6170)
8344
				if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8345
8346
					// Don't re-trigger an onFOO event when we call its FOO() method
8347
					tmp = elem[ ontype ];
8348
8349
					if ( tmp ) {
8350
						elem[ ontype ] = null;
8351
					}
8352
8353
					// Prevent re-triggering of the same event, since we already bubbled it above
8354
					jQuery.event.triggered = type;
8355
8356
					if ( event.isPropagationStopped() ) {
8357
						lastElement.addEventListener( type, stopPropagationCallback );
8358
					}
8359
8360
					elem[ type ]();
8361
8362
					if ( event.isPropagationStopped() ) {
8363
						lastElement.removeEventListener( type, stopPropagationCallback );
8364
					}
8365
8366
					jQuery.event.triggered = undefined;
8367
8368
					if ( tmp ) {
8369
						elem[ ontype ] = tmp;
8370
					}
8371
				}
8372
			}
8373
		}
8374
8375
		return event.result;
8376
	},
8377
8378
	// Piggyback on a donor event to simulate a different one
8379
	// Used only for `focus(in | out)` events
8380
	simulate: function( type, elem, event ) {
8381
		var e = jQuery.extend(
8382
			new jQuery.Event(),
8383
			event,
8384
			{
8385
				type: type,
8386
				isSimulated: true
8387
			}
8388
		);
8389
8390
		jQuery.event.trigger( e, null, elem );
8391
	}
8392
8393
} );
8394
8395
jQuery.fn.extend( {
8396
8397
	trigger: function( type, data ) {
8398
		return this.each( function() {
8399
			jQuery.event.trigger( type, data, this );
8400
		} );
8401
	},
8402
	triggerHandler: function( type, data ) {
8403
		var elem = this[ 0 ];
8404
		if ( elem ) {
8405
			return jQuery.event.trigger( type, data, elem, true );
8406
		}
8407
	}
8408
} );
8409
8410
8411
// Support: Firefox <=44
8412
// Firefox doesn't have focus(in | out) events
8413
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8414
//
8415
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8416
// focus(in | out) events fire after focus & blur events,
8417
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8418
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8419
if ( !support.focusin ) {
8420
	jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8421
8422
		// Attach a single capturing handler on the document while someone wants focusin/focusout
8423
		var handler = function( event ) {
8424
			jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8425
		};
8426
8427
		jQuery.event.special[ fix ] = {
8428
			setup: function() {
8429
				var doc = this.ownerDocument || this,
8430
					attaches = dataPriv.access( doc, fix );
8431
8432
				if ( !attaches ) {
8433
					doc.addEventListener( orig, handler, true );
8434
				}
8435
				dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8436
			},
8437
			teardown: function() {
8438
				var doc = this.ownerDocument || this,
8439
					attaches = dataPriv.access( doc, fix ) - 1;
8440
8441
				if ( !attaches ) {
8442
					doc.removeEventListener( orig, handler, true );
8443
					dataPriv.remove( doc, fix );
8444
8445
				} else {
8446
					dataPriv.access( doc, fix, attaches );
8447
				}
8448
			}
8449
		};
8450
	} );
8451
}
8452
var location = window.location;
8453
8454
var nonce = Date.now();
8455
8456
var rquery = ( /\?/ );
8457
8458
8459
8460
// Cross-browser xml parsing
8461
jQuery.parseXML = function( data ) {
8462
	var xml;
8463
	if ( !data || typeof data !== "string" ) {
8464
		return null;
8465
	}
8466
8467
	// Support: IE 9 - 11 only
8468
	// IE throws on parseFromString with invalid input.
8469
	try {
8470
		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8471
	} catch ( e ) {
8472
		xml = undefined;
8473
	}
8474
8475
	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
8476
		jQuery.error( "Invalid XML: " + data );
8477
	}
8478
	return xml;
8479
};
8480
8481
8482
var
8483
	rbracket = /\[\]$/,
8484
	rCRLF = /\r?\n/g,
8485
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8486
	rsubmittable = /^(?:input|select|textarea|keygen)/i;
8487
8488
function buildParams( prefix, obj, traditional, add ) {
8489
	var name;
8490
8491
	if ( Array.isArray( obj ) ) {
8492
8493
		// Serialize array item.
8494
		jQuery.each( obj, function( i, v ) {
8495
			if ( traditional || rbracket.test( prefix ) ) {
8496
8497
				// Treat each array item as a scalar.
8498
				add( prefix, v );
8499
8500
			} else {
8501
8502
				// Item is non-scalar (array or object), encode its numeric index.
8503
				buildParams(
8504
					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8505
					v,
8506
					traditional,
8507
					add
8508
				);
8509
			}
8510
		} );
8511
8512
	} else if ( !traditional && toType( obj ) === "object" ) {
8513
8514
		// Serialize object item.
8515
		for ( name in obj ) {
8516
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8517
		}
8518
8519
	} else {
8520
8521
		// Serialize scalar item.
8522
		add( prefix, obj );
8523
	}
8524
}
8525
8526
// Serialize an array of form elements or a set of
8527
// key/values into a query string
8528
jQuery.param = function( a, traditional ) {
8529
	var prefix,
8530
		s = [],
8531
		add = function( key, valueOrFunction ) {
8532
8533
			// If value is a function, invoke it and use its return value
8534
			var value = isFunction( valueOrFunction ) ?
8535
				valueOrFunction() :
8536
				valueOrFunction;
8537
8538
			s[ s.length ] = encodeURIComponent( key ) + "=" +
8539
				encodeURIComponent( value == null ? "" : value );
8540
		};
8541
8542
	// If an array was passed in, assume that it is an array of form elements.
8543
	if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8544
8545
		// Serialize the form elements
8546
		jQuery.each( a, function() {
8547
			add( this.name, this.value );
8548
		} );
8549
8550
	} else {
8551
8552
		// If traditional, encode the "old" way (the way 1.3.2 or older
8553
		// did it), otherwise encode params recursively.
8554
		for ( prefix in a ) {
8555
			buildParams( prefix, a[ prefix ], traditional, add );
8556
		}
8557
	}
8558
8559
	// Return the resulting serialization
8560
	return s.join( "&" );
8561
};
8562
8563
jQuery.fn.extend( {
8564
	serialize: function() {
8565
		return jQuery.param( this.serializeArray() );
8566
	},
8567
	serializeArray: function() {
8568
		return this.map( function() {
8569
8570
			// Can add propHook for "elements" to filter or add form elements
8571
			var elements = jQuery.prop( this, "elements" );
8572
			return elements ? jQuery.makeArray( elements ) : this;
8573
		} )
8574
		.filter( function() {
8575
			var type = this.type;
8576
8577
			// Use .is( ":disabled" ) so that fieldset[disabled] works
8578
			return this.name && !jQuery( this ).is( ":disabled" ) &&
8579
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8580
				( this.checked || !rcheckableType.test( type ) );
8581
		} )
8582
		.map( function( i, elem ) {
8583
			var val = jQuery( this ).val();
8584
8585
			if ( val == null ) {
8586
				return null;
8587
			}
8588
8589
			if ( Array.isArray( val ) ) {
8590
				return jQuery.map( val, function( val ) {
8591
					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8592
				} );
8593
			}
8594
8595
			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8596
		} ).get();
8597
	}
8598
} );
8599
8600
8601
var
8602
	r20 = /%20/g,
8603
	rhash = /#.*$/,
8604
	rantiCache = /([?&])_=[^&]*/,
8605
	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8606
8607
	// #7653, #8125, #8152: local protocol detection
8608
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8609
	rnoContent = /^(?:GET|HEAD)$/,
8610
	rprotocol = /^\/\//,
8611
8612
	/* Prefilters
8613
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8614
	 * 2) These are called:
8615
	 *    - BEFORE asking for a transport
8616
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
8617
	 * 3) key is the dataType
8618
	 * 4) the catchall symbol "*" can be used
8619
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8620
	 */
8621
	prefilters = {},
8622
8623
	/* Transports bindings
8624
	 * 1) key is the dataType
8625
	 * 2) the catchall symbol "*" can be used
8626
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
8627
	 */
8628
	transports = {},
8629
8630
	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8631
	allTypes = "*/".concat( "*" ),
8632
8633
	// Anchor tag for parsing the document origin
8634
	originAnchor = document.createElement( "a" );
8635
	originAnchor.href = location.href;
8636
8637
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8638
function addToPrefiltersOrTransports( structure ) {
8639
8640
	// dataTypeExpression is optional and defaults to "*"
8641
	return function( dataTypeExpression, func ) {
8642
8643
		if ( typeof dataTypeExpression !== "string" ) {
8644
			func = dataTypeExpression;
8645
			dataTypeExpression = "*";
8646
		}
8647
8648
		var dataType,
8649
			i = 0,
8650
			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8651
8652
		if ( isFunction( func ) ) {
8653
8654
			// For each dataType in the dataTypeExpression
8655
			while ( ( dataType = dataTypes[ i++ ] ) ) {
8656
8657
				// Prepend if requested
8658
				if ( dataType[ 0 ] === "+" ) {
8659
					dataType = dataType.slice( 1 ) || "*";
8660
					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8661
8662
				// Otherwise append
8663
				} else {
8664
					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8665
				}
8666
			}
8667
		}
8668
	};
8669
}
8670
8671
// Base inspection function for prefilters and transports
8672
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8673
8674
	var inspected = {},
8675
		seekingTransport = ( structure === transports );
8676
8677
	function inspect( dataType ) {
8678
		var selected;
8679
		inspected[ dataType ] = true;
8680
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8681
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8682
			if ( typeof dataTypeOrTransport === "string" &&
8683
				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8684
8685
				options.dataTypes.unshift( dataTypeOrTransport );
8686
				inspect( dataTypeOrTransport );
8687
				return false;
8688
			} else if ( seekingTransport ) {
8689
				return !( selected = dataTypeOrTransport );
8690
			}
8691
		} );
8692
		return selected;
8693
	}
8694
8695
	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8696
}
8697
8698
// A special extend for ajax options
8699
// that takes "flat" options (not to be deep extended)
8700
// Fixes #9887
8701
function ajaxExtend( target, src ) {
8702
	var key, deep,
8703
		flatOptions = jQuery.ajaxSettings.flatOptions || {};
8704
8705
	for ( key in src ) {
8706
		if ( src[ key ] !== undefined ) {
8707
			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8708
		}
8709
	}
8710
	if ( deep ) {
8711
		jQuery.extend( true, target, deep );
8712
	}
8713
8714
	return target;
8715
}
8716
8717
/* Handles responses to an ajax request:
8718
 * - finds the right dataType (mediates between content-type and expected dataType)
8719
 * - returns the corresponding response
8720
 */
8721
function ajaxHandleResponses( s, jqXHR, responses ) {
8722
8723
	var ct, type, finalDataType, firstDataType,
8724
		contents = s.contents,
8725
		dataTypes = s.dataTypes;
8726
8727
	// Remove auto dataType and get content-type in the process
8728
	while ( dataTypes[ 0 ] === "*" ) {
8729
		dataTypes.shift();
8730
		if ( ct === undefined ) {
8731
			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8732
		}
8733
	}
8734
8735
	// Check if we're dealing with a known content-type
8736
	if ( ct ) {
8737
		for ( type in contents ) {
8738
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
8739
				dataTypes.unshift( type );
8740
				break;
8741
			}
8742
		}
8743
	}
8744
8745
	// Check to see if we have a response for the expected dataType
8746
	if ( dataTypes[ 0 ] in responses ) {
8747
		finalDataType = dataTypes[ 0 ];
8748
	} else {
8749
8750
		// Try convertible dataTypes
8751
		for ( type in responses ) {
8752
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8753
				finalDataType = type;
8754
				break;
8755
			}
8756
			if ( !firstDataType ) {
8757
				firstDataType = type;
8758
			}
8759
		}
8760
8761
		// Or just use first one
8762
		finalDataType = finalDataType || firstDataType;
8763
	}
8764
8765
	// If we found a dataType
8766
	// We add the dataType to the list if needed
8767
	// and return the corresponding response
8768
	if ( finalDataType ) {
8769
		if ( finalDataType !== dataTypes[ 0 ] ) {
8770
			dataTypes.unshift( finalDataType );
8771
		}
8772
		return responses[ finalDataType ];
8773
	}
8774
}
8775
8776
/* Chain conversions given the request and the original response
8777
 * Also sets the responseXXX fields on the jqXHR instance
8778
 */
8779
function ajaxConvert( s, response, jqXHR, isSuccess ) {
8780
	var conv2, current, conv, tmp, prev,
8781
		converters = {},
8782
8783
		// Work with a copy of dataTypes in case we need to modify it for conversion
8784
		dataTypes = s.dataTypes.slice();
8785
8786
	// Create converters map with lowercased keys
8787
	if ( dataTypes[ 1 ] ) {
8788
		for ( conv in s.converters ) {
8789
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
8790
		}
8791
	}
8792
8793
	current = dataTypes.shift();
8794
8795
	// Convert to each sequential dataType
8796
	while ( current ) {
8797
8798
		if ( s.responseFields[ current ] ) {
8799
			jqXHR[ s.responseFields[ current ] ] = response;
8800
		}
8801
8802
		// Apply the dataFilter if provided
8803
		if ( !prev && isSuccess && s.dataFilter ) {
8804
			response = s.dataFilter( response, s.dataType );
8805
		}
8806
8807
		prev = current;
8808
		current = dataTypes.shift();
8809
8810
		if ( current ) {
8811
8812
			// There's only work to do if current dataType is non-auto
8813
			if ( current === "*" ) {
8814
8815
				current = prev;
8816
8817
			// Convert response if prev dataType is non-auto and differs from current
8818
			} else if ( prev !== "*" && prev !== current ) {
8819
8820
				// Seek a direct converter
8821
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8822
8823
				// If none found, seek a pair
8824
				if ( !conv ) {
8825
					for ( conv2 in converters ) {
8826
8827
						// If conv2 outputs current
8828
						tmp = conv2.split( " " );
8829
						if ( tmp[ 1 ] === current ) {
8830
8831
							// If prev can be converted to accepted input
8832
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
8833
								converters[ "* " + tmp[ 0 ] ];
8834
							if ( conv ) {
8835
8836
								// Condense equivalence converters
8837
								if ( conv === true ) {
8838
									conv = converters[ conv2 ];
8839
8840
								// Otherwise, insert the intermediate dataType
8841
								} else if ( converters[ conv2 ] !== true ) {
8842
									current = tmp[ 0 ];
8843
									dataTypes.unshift( tmp[ 1 ] );
8844
								}
8845
								break;
8846
							}
8847
						}
8848
					}
8849
				}
8850
8851
				// Apply converter (if not an equivalence)
8852
				if ( conv !== true ) {
8853
8854
					// Unless errors are allowed to bubble, catch and return them
8855
					if ( conv && s.throws ) {
8856
						response = conv( response );
8857
					} else {
8858
						try {
8859
							response = conv( response );
8860
						} catch ( e ) {
8861
							return {
8862
								state: "parsererror",
8863
								error: conv ? e : "No conversion from " + prev + " to " + current
8864
							};
8865
						}
8866
					}
8867
				}
8868
			}
8869
		}
8870
	}
8871
8872
	return { state: "success", data: response };
8873
}
8874
8875
jQuery.extend( {
8876
8877
	// Counter for holding the number of active queries
8878
	active: 0,
8879
8880
	// Last-Modified header cache for next request
8881
	lastModified: {},
8882
	etag: {},
8883
8884
	ajaxSettings: {
8885
		url: location.href,
8886
		type: "GET",
8887
		isLocal: rlocalProtocol.test( location.protocol ),
8888
		global: true,
8889
		processData: true,
8890
		async: true,
8891
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8892
8893
		/*
8894
		timeout: 0,
8895
		data: null,
8896
		dataType: null,
8897
		username: null,
8898
		password: null,
8899
		cache: null,
8900
		throws: false,
8901
		traditional: false,
8902
		headers: {},
8903
		*/
8904
8905
		accepts: {
8906
			"*": allTypes,
8907
			text: "text/plain",
8908
			html: "text/html",
8909
			xml: "application/xml, text/xml",
8910
			json: "application/json, text/javascript"
8911
		},
8912
8913
		contents: {
8914
			xml: /\bxml\b/,
8915
			html: /\bhtml/,
8916
			json: /\bjson\b/
8917
		},
8918
8919
		responseFields: {
8920
			xml: "responseXML",
8921
			text: "responseText",
8922
			json: "responseJSON"
8923
		},
8924
8925
		// Data converters
8926
		// Keys separate source (or catchall "*") and destination types with a single space
8927
		converters: {
8928
8929
			// Convert anything to text
8930
			"* text": String,
8931
8932
			// Text to html (true = no transformation)
8933
			"text html": true,
8934
8935
			// Evaluate text as a json expression
8936
			"text json": JSON.parse,
8937
8938
			// Parse text as xml
8939
			"text xml": jQuery.parseXML
8940
		},
8941
8942
		// For options that shouldn't be deep extended:
8943
		// you can add your own custom options here if
8944
		// and when you create one that shouldn't be
8945
		// deep extended (see ajaxExtend)
8946
		flatOptions: {
8947
			url: true,
8948
			context: true
8949
		}
8950
	},
8951
8952
	// Creates a full fledged settings object into target
8953
	// with both ajaxSettings and settings fields.
8954
	// If target is omitted, writes into ajaxSettings.
8955
	ajaxSetup: function( target, settings ) {
8956
		return settings ?
8957
8958
			// Building a settings object
8959
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8960
8961
			// Extending ajaxSettings
8962
			ajaxExtend( jQuery.ajaxSettings, target );
8963
	},
8964
8965
	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8966
	ajaxTransport: addToPrefiltersOrTransports( transports ),
8967
8968
	// Main method
8969
	ajax: function( url, options ) {
8970
8971
		// If url is an object, simulate pre-1.5 signature
8972
		if ( typeof url === "object" ) {
8973
			options = url;
8974
			url = undefined;
8975
		}
8976
8977
		// Force options to be an object
8978
		options = options || {};
8979
8980
		var transport,
8981
8982
			// URL without anti-cache param
8983
			cacheURL,
8984
8985
			// Response headers
8986
			responseHeadersString,
8987
			responseHeaders,
8988
8989
			// timeout handle
8990
			timeoutTimer,
8991
8992
			// Url cleanup var
8993
			urlAnchor,
8994
8995
			// Request state (becomes false upon send and true upon completion)
8996
			completed,
8997
8998
			// To know if global events are to be dispatched
8999
			fireGlobals,
9000
9001
			// Loop variable
9002
			i,
9003
9004
			// uncached part of the url
9005
			uncached,
9006
9007
			// Create the final options object
9008
			s = jQuery.ajaxSetup( {}, options ),
9009
9010
			// Callbacks context
9011
			callbackContext = s.context || s,
9012
9013
			// Context for global events is callbackContext if it is a DOM node or jQuery collection
9014
			globalEventContext = s.context &&
9015
				( callbackContext.nodeType || callbackContext.jquery ) ?
9016
					jQuery( callbackContext ) :
9017
					jQuery.event,
9018
9019
			// Deferreds
9020
			deferred = jQuery.Deferred(),
9021
			completeDeferred = jQuery.Callbacks( "once memory" ),
9022
9023
			// Status-dependent callbacks
9024
			statusCode = s.statusCode || {},
9025
9026
			// Headers (they are sent all at once)
9027
			requestHeaders = {},
9028
			requestHeadersNames = {},
9029
9030
			// Default abort message
9031
			strAbort = "canceled",
9032
9033
			// Fake xhr
9034
			jqXHR = {
9035
				readyState: 0,
9036
9037
				// Builds headers hashtable if needed
9038
				getResponseHeader: function( key ) {
9039
					var match;
9040
					if ( completed ) {
9041
						if ( !responseHeaders ) {
9042
							responseHeaders = {};
9043
							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
9044
								responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
9045
							}
9046
						}
9047
						match = responseHeaders[ key.toLowerCase() ];
9048
					}
9049
					return match == null ? null : match;
9050
				},
9051
9052
				// Raw string
9053
				getAllResponseHeaders: function() {
9054
					return completed ? responseHeadersString : null;
9055
				},
9056
9057
				// Caches the header
9058
				setRequestHeader: function( name, value ) {
9059
					if ( completed == null ) {
9060
						name = requestHeadersNames[ name.toLowerCase() ] =
9061
							requestHeadersNames[ name.toLowerCase() ] || name;
9062
						requestHeaders[ name ] = value;
9063
					}
9064
					return this;
9065
				},
9066
9067
				// Overrides response content-type header
9068
				overrideMimeType: function( type ) {
9069
					if ( completed == null ) {
9070
						s.mimeType = type;
9071
					}
9072
					return this;
9073
				},
9074
9075
				// Status-dependent callbacks
9076
				statusCode: function( map ) {
9077
					var code;
9078
					if ( map ) {
9079
						if ( completed ) {
9080
9081
							// Execute the appropriate callbacks
9082
							jqXHR.always( map[ jqXHR.status ] );
9083
						} else {
9084
9085
							// Lazy-add the new callbacks in a way that preserves old ones
9086
							for ( code in map ) {
9087
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9088
							}
9089
						}
9090
					}
9091
					return this;
9092
				},
9093
9094
				// Cancel the request
9095
				abort: function( statusText ) {
9096
					var finalText = statusText || strAbort;
9097
					if ( transport ) {
9098
						transport.abort( finalText );
9099
					}
9100
					done( 0, finalText );
9101
					return this;
9102
				}
9103
			};
9104
9105
		// Attach deferreds
9106
		deferred.promise( jqXHR );
9107
9108
		// Add protocol if not provided (prefilters might expect it)
9109
		// Handle falsy url in the settings object (#10093: consistency with old signature)
9110
		// We also use the url parameter if available
9111
		s.url = ( ( url || s.url || location.href ) + "" )
9112
			.replace( rprotocol, location.protocol + "//" );
9113
9114
		// Alias method option to type as per ticket #12004
9115
		s.type = options.method || options.type || s.method || s.type;
9116
9117
		// Extract dataTypes list
9118
		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9119
9120
		// A cross-domain request is in order when the origin doesn't match the current origin.
9121
		if ( s.crossDomain == null ) {
9122
			urlAnchor = document.createElement( "a" );
9123
9124
			// Support: IE <=8 - 11, Edge 12 - 15
9125
			// IE throws exception on accessing the href property if url is malformed,
9126
			// e.g. http://example.com:80x/
9127
			try {
9128
				urlAnchor.href = s.url;
9129
9130
				// Support: IE <=8 - 11 only
9131
				// Anchor's host property isn't correctly set when s.url is relative
9132
				urlAnchor.href = urlAnchor.href;
9133
				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9134
					urlAnchor.protocol + "//" + urlAnchor.host;
9135
			} catch ( e ) {
9136
9137
				// If there is an error parsing the URL, assume it is crossDomain,
9138
				// it can be rejected by the transport if it is invalid
9139
				s.crossDomain = true;
9140
			}
9141
		}
9142
9143
		// Convert data if not already a string
9144
		if ( s.data && s.processData && typeof s.data !== "string" ) {
9145
			s.data = jQuery.param( s.data, s.traditional );
9146
		}
9147
9148
		// Apply prefilters
9149
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9150
9151
		// If request was aborted inside a prefilter, stop there
9152
		if ( completed ) {
9153
			return jqXHR;
9154
		}
9155
9156
		// We can fire global events as of now if asked to
9157
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
9158
		fireGlobals = jQuery.event && s.global;
9159
9160
		// Watch for a new set of requests
9161
		if ( fireGlobals && jQuery.active++ === 0 ) {
9162
			jQuery.event.trigger( "ajaxStart" );
9163
		}
9164
9165
		// Uppercase the type
9166
		s.type = s.type.toUpperCase();
9167
9168
		// Determine if request has content
9169
		s.hasContent = !rnoContent.test( s.type );
9170
9171
		// Save the URL in case we're toying with the If-Modified-Since
9172
		// and/or If-None-Match header later on
9173
		// Remove hash to simplify url manipulation
9174
		cacheURL = s.url.replace( rhash, "" );
9175
9176
		// More options handling for requests with no content
9177
		if ( !s.hasContent ) {
9178
9179
			// Remember the hash so we can put it back
9180
			uncached = s.url.slice( cacheURL.length );
9181
9182
			// If data is available and should be processed, append data to url
9183
			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9184
				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9185
9186
				// #9682: remove data so that it's not used in an eventual retry
9187
				delete s.data;
9188
			}
9189
9190
			// Add or update anti-cache param if needed
9191
			if ( s.cache === false ) {
9192
				cacheURL = cacheURL.replace( rantiCache, "$1" );
9193
				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9194
			}
9195
9196
			// Put hash and anti-cache on the URL that will be requested (gh-1732)
9197
			s.url = cacheURL + uncached;
9198
9199
		// Change '%20' to '+' if this is encoded form body content (gh-2658)
9200
		} else if ( s.data && s.processData &&
9201
			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9202
			s.data = s.data.replace( r20, "+" );
9203
		}
9204
9205
		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9206
		if ( s.ifModified ) {
9207
			if ( jQuery.lastModified[ cacheURL ] ) {
9208
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9209
			}
9210
			if ( jQuery.etag[ cacheURL ] ) {
9211
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9212
			}
9213
		}
9214
9215
		// Set the correct header, if data is being sent
9216
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9217
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
9218
		}
9219
9220
		// Set the Accepts header for the server, depending on the dataType
9221
		jqXHR.setRequestHeader(
9222
			"Accept",
9223
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9224
				s.accepts[ s.dataTypes[ 0 ] ] +
9225
					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9226
				s.accepts[ "*" ]
9227
		);
9228
9229
		// Check for headers option
9230
		for ( i in s.headers ) {
9231
			jqXHR.setRequestHeader( i, s.headers[ i ] );
9232
		}
9233
9234
		// Allow custom headers/mimetypes and early abort
9235
		if ( s.beforeSend &&
9236
			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9237
9238
			// Abort if not done already and return
9239
			return jqXHR.abort();
9240
		}
9241
9242
		// Aborting is no longer a cancellation
9243
		strAbort = "abort";
9244
9245
		// Install callbacks on deferreds
9246
		completeDeferred.add( s.complete );
9247
		jqXHR.done( s.success );
9248
		jqXHR.fail( s.error );
9249
9250
		// Get transport
9251
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9252
9253
		// If no transport, we auto-abort
9254
		if ( !transport ) {
9255
			done( -1, "No Transport" );
9256
		} else {
9257
			jqXHR.readyState = 1;
9258
9259
			// Send global event
9260
			if ( fireGlobals ) {
9261
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9262
			}
9263
9264
			// If request was aborted inside ajaxSend, stop there
9265
			if ( completed ) {
9266
				return jqXHR;
9267
			}
9268
9269
			// Timeout
9270
			if ( s.async && s.timeout > 0 ) {
9271
				timeoutTimer = window.setTimeout( function() {
9272
					jqXHR.abort( "timeout" );
9273
				}, s.timeout );
9274
			}
9275
9276
			try {
9277
				completed = false;
9278
				transport.send( requestHeaders, done );
9279
			} catch ( e ) {
9280
9281
				// Rethrow post-completion exceptions
9282
				if ( completed ) {
9283
					throw e;
9284
				}
9285
9286
				// Propagate others as results
9287
				done( -1, e );
9288
			}
9289
		}
9290
9291
		// Callback for when everything is done
9292
		function done( status, nativeStatusText, responses, headers ) {
9293
			var isSuccess, success, error, response, modified,
9294
				statusText = nativeStatusText;
9295
9296
			// Ignore repeat invocations
9297
			if ( completed ) {
9298
				return;
9299
			}
9300
9301
			completed = true;
9302
9303
			// Clear timeout if it exists
9304
			if ( timeoutTimer ) {
9305
				window.clearTimeout( timeoutTimer );
9306
			}
9307
9308
			// Dereference transport for early garbage collection
9309
			// (no matter how long the jqXHR object will be used)
9310
			transport = undefined;
9311
9312
			// Cache response headers
9313
			responseHeadersString = headers || "";
9314
9315
			// Set readyState
9316
			jqXHR.readyState = status > 0 ? 4 : 0;
9317
9318
			// Determine if successful
9319
			isSuccess = status >= 200 && status < 300 || status === 304;
9320
9321
			// Get response data
9322
			if ( responses ) {
9323
				response = ajaxHandleResponses( s, jqXHR, responses );
9324
			}
9325
9326
			// Convert no matter what (that way responseXXX fields are always set)
9327
			response = ajaxConvert( s, response, jqXHR, isSuccess );
9328
9329
			// If successful, handle type chaining
9330
			if ( isSuccess ) {
9331
9332
				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9333
				if ( s.ifModified ) {
9334
					modified = jqXHR.getResponseHeader( "Last-Modified" );
9335
					if ( modified ) {
9336
						jQuery.lastModified[ cacheURL ] = modified;
9337
					}
9338
					modified = jqXHR.getResponseHeader( "etag" );
9339
					if ( modified ) {
9340
						jQuery.etag[ cacheURL ] = modified;
9341
					}
9342
				}
9343
9344
				// if no content
9345
				if ( status === 204 || s.type === "HEAD" ) {
9346
					statusText = "nocontent";
9347
9348
				// if not modified
9349
				} else if ( status === 304 ) {
9350
					statusText = "notmodified";
9351
9352
				// If we have data, let's convert it
9353
				} else {
9354
					statusText = response.state;
9355
					success = response.data;
9356
					error = response.error;
9357
					isSuccess = !error;
9358
				}
9359
			} else {
9360
9361
				// Extract error from statusText and normalize for non-aborts
9362
				error = statusText;
9363
				if ( status || !statusText ) {
9364
					statusText = "error";
9365
					if ( status < 0 ) {
9366
						status = 0;
9367
					}
9368
				}
9369
			}
9370
9371
			// Set data for the fake xhr object
9372
			jqXHR.status = status;
9373
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9374
9375
			// Success/Error
9376
			if ( isSuccess ) {
9377
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9378
			} else {
9379
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9380
			}
9381
9382
			// Status-dependent callbacks
9383
			jqXHR.statusCode( statusCode );
9384
			statusCode = undefined;
9385
9386
			if ( fireGlobals ) {
9387
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9388
					[ jqXHR, s, isSuccess ? success : error ] );
9389
			}
9390
9391
			// Complete
9392
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9393
9394
			if ( fireGlobals ) {
9395
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9396
9397
				// Handle the global AJAX counter
9398
				if ( !( --jQuery.active ) ) {
9399
					jQuery.event.trigger( "ajaxStop" );
9400
				}
9401
			}
9402
		}
9403
9404
		return jqXHR;
9405
	},
9406
9407
	getJSON: function( url, data, callback ) {
9408
		return jQuery.get( url, data, callback, "json" );
9409
	},
9410
9411
	getScript: function( url, callback ) {
9412
		return jQuery.get( url, undefined, callback, "script" );
9413
	}
9414
} );
9415
9416
jQuery.each( [ "get", "post" ], function( i, method ) {
9417
	jQuery[ method ] = function( url, data, callback, type ) {
9418
9419
		// Shift arguments if data argument was omitted
9420
		if ( isFunction( data ) ) {
9421
			type = type || callback;
9422
			callback = data;
9423
			data = undefined;
9424
		}
9425
9426
		// The url can be an options object (which then must have .url)
9427
		return jQuery.ajax( jQuery.extend( {
9428
			url: url,
9429
			type: method,
9430
			dataType: type,
9431
			data: data,
9432
			success: callback
9433
		}, jQuery.isPlainObject( url ) && url ) );
9434
	};
9435
} );
9436
9437
9438
jQuery._evalUrl = function( url ) {
9439
	return jQuery.ajax( {
9440
		url: url,
9441
9442
		// Make this explicit, since user can override this through ajaxSetup (#11264)
9443
		type: "GET",
9444
		dataType: "script",
9445
		cache: true,
9446
		async: false,
9447
		global: false,
9448
		"throws": true
9449
	} );
9450
};
9451
9452
9453
jQuery.fn.extend( {
9454
	wrapAll: function( html ) {
9455
		var wrap;
9456
9457
		if ( this[ 0 ] ) {
9458
			if ( isFunction( html ) ) {
9459
				html = html.call( this[ 0 ] );
9460
			}
9461
9462
			// The elements to wrap the target around
9463
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9464
9465
			if ( this[ 0 ].parentNode ) {
9466
				wrap.insertBefore( this[ 0 ] );
9467
			}
9468
9469
			wrap.map( function() {
9470
				var elem = this;
9471
9472
				while ( elem.firstElementChild ) {
9473
					elem = elem.firstElementChild;
9474
				}
9475
9476
				return elem;
9477
			} ).append( this );
9478
		}
9479
9480
		return this;
9481
	},
9482
9483
	wrapInner: function( html ) {
9484
		if ( isFunction( html ) ) {
9485
			return this.each( function( i ) {
9486
				jQuery( this ).wrapInner( html.call( this, i ) );
9487
			} );
9488
		}
9489
9490
		return this.each( function() {
9491
			var self = jQuery( this ),
9492
				contents = self.contents();
9493
9494
			if ( contents.length ) {
9495
				contents.wrapAll( html );
9496
9497
			} else {
9498
				self.append( html );
9499
			}
9500
		} );
9501
	},
9502
9503
	wrap: function( html ) {
9504
		var htmlIsFunction = isFunction( html );
9505
9506
		return this.each( function( i ) {
9507
			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
9508
		} );
9509
	},
9510
9511
	unwrap: function( selector ) {
9512
		this.parent( selector ).not( "body" ).each( function() {
9513
			jQuery( this ).replaceWith( this.childNodes );
9514
		} );
9515
		return this;
9516
	}
9517
} );
9518
9519
9520
jQuery.expr.pseudos.hidden = function( elem ) {
9521
	return !jQuery.expr.pseudos.visible( elem );
9522
};
9523
jQuery.expr.pseudos.visible = function( elem ) {
9524
	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9525
};
9526
9527
9528
9529
9530
jQuery.ajaxSettings.xhr = function() {
9531
	try {
9532
		return new window.XMLHttpRequest();
9533
	} catch ( e ) {}
9534
};
9535
9536
var xhrSuccessStatus = {
9537
9538
		// File protocol always yields status code 0, assume 200
9539
		0: 200,
9540
9541
		// Support: IE <=9 only
9542
		// #1450: sometimes IE returns 1223 when it should be 204
9543
		1223: 204
9544
	},
9545
	xhrSupported = jQuery.ajaxSettings.xhr();
9546
9547
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9548
support.ajax = xhrSupported = !!xhrSupported;
9549
9550
jQuery.ajaxTransport( function( options ) {
9551
	var callback, errorCallback;
9552
9553
	// Cross domain only allowed if supported through XMLHttpRequest
9554
	if ( support.cors || xhrSupported && !options.crossDomain ) {
9555
		return {
9556
			send: function( headers, complete ) {
9557
				var i,
9558
					xhr = options.xhr();
9559
9560
				xhr.open(
9561
					options.type,
9562
					options.url,
9563
					options.async,
9564
					options.username,
9565
					options.password
9566
				);
9567
9568
				// Apply custom fields if provided
9569
				if ( options.xhrFields ) {
9570
					for ( i in options.xhrFields ) {
9571
						xhr[ i ] = options.xhrFields[ i ];
9572
					}
9573
				}
9574
9575
				// Override mime type if needed
9576
				if ( options.mimeType && xhr.overrideMimeType ) {
9577
					xhr.overrideMimeType( options.mimeType );
9578
				}
9579
9580
				// X-Requested-With header
9581
				// For cross-domain requests, seeing as conditions for a preflight are
9582
				// akin to a jigsaw puzzle, we simply never set it to be sure.
9583
				// (it can always be set on a per-request basis or even using ajaxSetup)
9584
				// For same-domain requests, won't change header if already provided.
9585
				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9586
					headers[ "X-Requested-With" ] = "XMLHttpRequest";
9587
				}
9588
9589
				// Set headers
9590
				for ( i in headers ) {
9591
					xhr.setRequestHeader( i, headers[ i ] );
9592
				}
9593
9594
				// Callback
9595
				callback = function( type ) {
9596
					return function() {
9597
						if ( callback ) {
9598
							callback = errorCallback = xhr.onload =
9599
								xhr.onerror = xhr.onabort = xhr.ontimeout =
9600
									xhr.onreadystatechange = null;
9601
9602
							if ( type === "abort" ) {
9603
								xhr.abort();
9604
							} else if ( type === "error" ) {
9605
9606
								// Support: IE <=9 only
9607
								// On a manual native abort, IE9 throws
9608
								// errors on any property access that is not readyState
9609
								if ( typeof xhr.status !== "number" ) {
9610
									complete( 0, "error" );
9611
								} else {
9612
									complete(
9613
9614
										// File: protocol always yields status 0; see #8605, #14207
9615
										xhr.status,
9616
										xhr.statusText
9617
									);
9618
								}
9619
							} else {
9620
								complete(
9621
									xhrSuccessStatus[ xhr.status ] || xhr.status,
9622
									xhr.statusText,
9623
9624
									// Support: IE <=9 only
9625
									// IE9 has no XHR2 but throws on binary (trac-11426)
9626
									// For XHR2 non-text, let the caller handle it (gh-2498)
9627
									( xhr.responseType || "text" ) !== "text"  ||
9628
									typeof xhr.responseText !== "string" ?
9629
										{ binary: xhr.response } :
9630
										{ text: xhr.responseText },
9631
									xhr.getAllResponseHeaders()
9632
								);
9633
							}
9634
						}
9635
					};
9636
				};
9637
9638
				// Listen to events
9639
				xhr.onload = callback();
9640
				errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
9641
9642
				// Support: IE 9 only
9643
				// Use onreadystatechange to replace onabort
9644
				// to handle uncaught aborts
9645
				if ( xhr.onabort !== undefined ) {
9646
					xhr.onabort = errorCallback;
9647
				} else {
9648
					xhr.onreadystatechange = function() {
9649
9650
						// Check readyState before timeout as it changes
9651
						if ( xhr.readyState === 4 ) {
9652
9653
							// Allow onerror to be called first,
9654
							// but that will not handle a native abort
9655
							// Also, save errorCallback to a variable
9656
							// as xhr.onerror cannot be accessed
9657
							window.setTimeout( function() {
9658
								if ( callback ) {
9659
									errorCallback();
9660
								}
9661
							} );
9662
						}
9663
					};
9664
				}
9665
9666
				// Create the abort callback
9667
				callback = callback( "abort" );
9668
9669
				try {
9670
9671
					// Do send the request (this may raise an exception)
9672
					xhr.send( options.hasContent && options.data || null );
9673
				} catch ( e ) {
9674
9675
					// #14683: Only rethrow if this hasn't been notified as an error yet
9676
					if ( callback ) {
9677
						throw e;
9678
					}
9679
				}
9680
			},
9681
9682
			abort: function() {
9683
				if ( callback ) {
9684
					callback();
9685
				}
9686
			}
9687
		};
9688
	}
9689
} );
9690
9691
9692
9693
9694
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9695
jQuery.ajaxPrefilter( function( s ) {
9696
	if ( s.crossDomain ) {
9697
		s.contents.script = false;
9698
	}
9699
} );
9700
9701
// Install script dataType
9702
jQuery.ajaxSetup( {
9703
	accepts: {
9704
		script: "text/javascript, application/javascript, " +
9705
			"application/ecmascript, application/x-ecmascript"
9706
	},
9707
	contents: {
9708
		script: /\b(?:java|ecma)script\b/
9709
	},
9710
	converters: {
9711
		"text script": function( text ) {
9712
			jQuery.globalEval( text );
9713
			return text;
9714
		}
9715
	}
9716
} );
9717
9718
// Handle cache's special case and crossDomain
9719
jQuery.ajaxPrefilter( "script", function( s ) {
9720
	if ( s.cache === undefined ) {
9721
		s.cache = false;
9722
	}
9723
	if ( s.crossDomain ) {
9724
		s.type = "GET";
9725
	}
9726
} );
9727
9728
// Bind script tag hack transport
9729
jQuery.ajaxTransport( "script", function( s ) {
9730
9731
	// This transport only deals with cross domain requests
9732
	if ( s.crossDomain ) {
9733
		var script, callback;
9734
		return {
9735
			send: function( _, complete ) {
9736
				script = jQuery( "<script>" ).prop( {
9737
					charset: s.scriptCharset,
9738
					src: s.url
9739
				} ).on(
9740
					"load error",
9741
					callback = function( evt ) {
9742
						script.remove();
9743
						callback = null;
9744
						if ( evt ) {
9745
							complete( evt.type === "error" ? 404 : 200, evt.type );
9746
						}
9747
					}
9748
				);
9749
9750
				// Use native DOM manipulation to avoid our domManip AJAX trickery
9751
				document.head.appendChild( script[ 0 ] );
9752
			},
9753
			abort: function() {
9754
				if ( callback ) {
9755
					callback();
9756
				}
9757
			}
9758
		};
9759
	}
9760
} );
9761
9762
9763
9764
9765
var oldCallbacks = [],
9766
	rjsonp = /(=)\?(?=&|$)|\?\?/;
9767
9768
// Default jsonp settings
9769
jQuery.ajaxSetup( {
9770
	jsonp: "callback",
9771
	jsonpCallback: function() {
9772
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9773
		this[ callback ] = true;
9774
		return callback;
9775
	}
9776
} );
9777
9778
// Detect, normalize options and install callbacks for jsonp requests
9779
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9780
9781
	var callbackName, overwritten, responseContainer,
9782
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9783
			"url" :
9784
			typeof s.data === "string" &&
9785
				( s.contentType || "" )
9786
					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
9787
				rjsonp.test( s.data ) && "data"
9788
		);
9789
9790
	// Handle iff the expected data type is "jsonp" or we have a parameter to set
9791
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9792
9793
		// Get callback name, remembering preexisting value associated with it
9794
		callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
9795
			s.jsonpCallback() :
9796
			s.jsonpCallback;
9797
9798
		// Insert callback into url or form data
9799
		if ( jsonProp ) {
9800
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9801
		} else if ( s.jsonp !== false ) {
9802
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9803
		}
9804
9805
		// Use data converter to retrieve json after script execution
9806
		s.converters[ "script json" ] = function() {
9807
			if ( !responseContainer ) {
9808
				jQuery.error( callbackName + " was not called" );
9809
			}
9810
			return responseContainer[ 0 ];
9811
		};
9812
9813
		// Force json dataType
9814
		s.dataTypes[ 0 ] = "json";
9815
9816
		// Install callback
9817
		overwritten = window[ callbackName ];
9818
		window[ callbackName ] = function() {
9819
			responseContainer = arguments;
9820
		};
9821
9822
		// Clean-up function (fires after converters)
9823
		jqXHR.always( function() {
9824
9825
			// If previous value didn't exist - remove it
9826
			if ( overwritten === undefined ) {
9827
				jQuery( window ).removeProp( callbackName );
9828
9829
			// Otherwise restore preexisting value
9830
			} else {
9831
				window[ callbackName ] = overwritten;
9832
			}
9833
9834
			// Save back as free
9835
			if ( s[ callbackName ] ) {
9836
9837
				// Make sure that re-using the options doesn't screw things around
9838
				s.jsonpCallback = originalSettings.jsonpCallback;
9839
9840
				// Save the callback name for future use
9841
				oldCallbacks.push( callbackName );
9842
			}
9843
9844
			// Call if it was a function and we have a response
9845
			if ( responseContainer && isFunction( overwritten ) ) {
9846
				overwritten( responseContainer[ 0 ] );
9847
			}
9848
9849
			responseContainer = overwritten = undefined;
9850
		} );
9851
9852
		// Delegate to script
9853
		return "script";
9854
	}
9855
} );
9856
9857
9858
9859
9860
// Support: Safari 8 only
9861
// In Safari 8 documents created via document.implementation.createHTMLDocument
9862
// collapse sibling forms: the second one becomes a child of the first one.
9863
// Because of that, this security measure has to be disabled in Safari 8.
9864
// https://bugs.webkit.org/show_bug.cgi?id=137337
9865
support.createHTMLDocument = ( function() {
9866
	var body = document.implementation.createHTMLDocument( "" ).body;
9867
	body.innerHTML = "<form></form><form></form>";
9868
	return body.childNodes.length === 2;
9869
} )();
9870
9871
9872
// Argument "data" should be string of html
9873
// context (optional): If specified, the fragment will be created in this context,
9874
// defaults to document
9875
// keepScripts (optional): If true, will include scripts passed in the html string
9876
jQuery.parseHTML = function( data, context, keepScripts ) {
9877
	if ( typeof data !== "string" ) {
9878
		return [];
9879
	}
9880
	if ( typeof context === "boolean" ) {
9881
		keepScripts = context;
9882
		context = false;
9883
	}
9884
9885
	var base, parsed, scripts;
9886
9887
	if ( !context ) {
9888
9889
		// Stop scripts or inline event handlers from being executed immediately
9890
		// by using document.implementation
9891
		if ( support.createHTMLDocument ) {
9892
			context = document.implementation.createHTMLDocument( "" );
9893
9894
			// Set the base href for the created document
9895
			// so any parsed elements with URLs
9896
			// are based on the document's URL (gh-2965)
9897
			base = context.createElement( "base" );
9898
			base.href = document.location.href;
9899
			context.head.appendChild( base );
9900
		} else {
9901
			context = document;
9902
		}
9903
	}
9904
9905
	parsed = rsingleTag.exec( data );
9906
	scripts = !keepScripts && [];
9907
9908
	// Single tag
9909
	if ( parsed ) {
9910
		return [ context.createElement( parsed[ 1 ] ) ];
9911
	}
9912
9913
	parsed = buildFragment( [ data ], context, scripts );
9914
9915
	if ( scripts && scripts.length ) {
9916
		jQuery( scripts ).remove();
9917
	}
9918
9919
	return jQuery.merge( [], parsed.childNodes );
9920
};
9921
9922
9923
/**
9924
 * Load a url into a page
9925
 */
9926
jQuery.fn.load = function( url, params, callback ) {
9927
	var selector, type, response,
9928
		self = this,
9929
		off = url.indexOf( " " );
9930
9931
	if ( off > -1 ) {
9932
		selector = stripAndCollapse( url.slice( off ) );
9933
		url = url.slice( 0, off );
9934
	}
9935
9936
	// If it's a function
9937
	if ( isFunction( params ) ) {
9938
9939
		// We assume that it's the callback
9940
		callback = params;
9941
		params = undefined;
9942
9943
	// Otherwise, build a param string
9944
	} else if ( params && typeof params === "object" ) {
9945
		type = "POST";
9946
	}
9947
9948
	// If we have elements to modify, make the request
9949
	if ( self.length > 0 ) {
9950
		jQuery.ajax( {
9951
			url: url,
9952
9953
			// If "type" variable is undefined, then "GET" method will be used.
9954
			// Make value of this field explicit since
9955
			// user can override it through ajaxSetup method
9956
			type: type || "GET",
9957
			dataType: "html",
9958
			data: params
9959
		} ).done( function( responseText ) {
9960
9961
			// Save response for use in complete callback
9962
			response = arguments;
9963
9964
			self.html( selector ?
9965
9966
				// If a selector was specified, locate the right elements in a dummy div
9967
				// Exclude scripts to avoid IE 'Permission Denied' errors
9968
				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
9969
9970
				// Otherwise use the full result
9971
				responseText );
9972
9973
		// If the request succeeds, this function gets "data", "status", "jqXHR"
9974
		// but they are ignored because response was set above.
9975
		// If it fails, this function gets "jqXHR", "status", "error"
9976
		} ).always( callback && function( jqXHR, status ) {
9977
			self.each( function() {
9978
				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
9979
			} );
9980
		} );
9981
	}
9982
9983
	return this;
9984
};
9985
9986
9987
9988
9989
// Attach a bunch of functions for handling common AJAX events
9990
jQuery.each( [
9991
	"ajaxStart",
9992
	"ajaxStop",
9993
	"ajaxComplete",
9994
	"ajaxError",
9995
	"ajaxSuccess",
9996
	"ajaxSend"
9997
], function( i, type ) {
9998
	jQuery.fn[ type ] = function( fn ) {
9999
		return this.on( type, fn );
10000
	};
10001
} );
10002
10003
10004
10005
10006
jQuery.expr.pseudos.animated = function( elem ) {
10007
	return jQuery.grep( jQuery.timers, function( fn ) {
10008
		return elem === fn.elem;
10009
	} ).length;
10010
};
10011
10012
10013
10014
10015
jQuery.offset = {
10016
	setOffset: function( elem, options, i ) {
10017
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10018
			position = jQuery.css( elem, "position" ),
10019
			curElem = jQuery( elem ),
10020
			props = {};
10021
10022
		// Set position first, in-case top/left are set even on static elem
10023
		if ( position === "static" ) {
10024
			elem.style.position = "relative";
10025
		}
10026
10027
		curOffset = curElem.offset();
10028
		curCSSTop = jQuery.css( elem, "top" );
10029
		curCSSLeft = jQuery.css( elem, "left" );
10030
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10031
			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
10032
10033
		// Need to be able to calculate position if either
10034
		// top or left is auto and position is either absolute or fixed
10035
		if ( calculatePosition ) {
10036
			curPosition = curElem.position();
10037
			curTop = curPosition.top;
10038
			curLeft = curPosition.left;
10039
10040
		} else {
10041
			curTop = parseFloat( curCSSTop ) || 0;
10042
			curLeft = parseFloat( curCSSLeft ) || 0;
10043
		}
10044
10045
		if ( isFunction( options ) ) {
10046
10047
			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
10048
			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
10049
		}
10050
10051
		if ( options.top != null ) {
10052
			props.top = ( options.top - curOffset.top ) + curTop;
10053
		}
10054
		if ( options.left != null ) {
10055
			props.left = ( options.left - curOffset.left ) + curLeft;
10056
		}
10057
10058
		if ( "using" in options ) {
10059
			options.using.call( elem, props );
10060
10061
		} else {
10062
			curElem.css( props );
10063
		}
10064
	}
10065
};
10066
10067
jQuery.fn.extend( {
10068
10069
	// offset() relates an element's border box to the document origin
10070
	offset: function( options ) {
10071
10072
		// Preserve chaining for setter
10073
		if ( arguments.length ) {
10074
			return options === undefined ?
10075
				this :
10076
				this.each( function( i ) {
10077
					jQuery.offset.setOffset( this, options, i );
10078
				} );
10079
		}
10080
10081
		var rect, win,
10082
			elem = this[ 0 ];
10083
10084
		if ( !elem ) {
10085
			return;
10086
		}
10087
10088
		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
10089
		// Support: IE <=11 only
10090
		// Running getBoundingClientRect on a
10091
		// disconnected node in IE throws an error
10092
		if ( !elem.getClientRects().length ) {
10093
			return { top: 0, left: 0 };
10094
		}
10095
10096
		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
10097
		rect = elem.getBoundingClientRect();
10098
		win = elem.ownerDocument.defaultView;
10099
		return {
10100
			top: rect.top + win.pageYOffset,
10101
			left: rect.left + win.pageXOffset
10102
		};
10103
	},
10104
10105
	// position() relates an element's margin box to its offset parent's padding box
10106
	// This corresponds to the behavior of CSS absolute positioning
10107
	position: function() {
10108
		if ( !this[ 0 ] ) {
10109
			return;
10110
		}
10111
10112
		var offsetParent, offset, doc,
10113
			elem = this[ 0 ],
10114
			parentOffset = { top: 0, left: 0 };
10115
10116
		// position:fixed elements are offset from the viewport, which itself always has zero offset
10117
		if ( jQuery.css( elem, "position" ) === "fixed" ) {
10118
10119
			// Assume position:fixed implies availability of getBoundingClientRect
10120
			offset = elem.getBoundingClientRect();
10121
10122
		} else {
10123
			offset = this.offset();
10124
10125
			// Account for the *real* offset parent, which can be the document or its root element
10126
			// when a statically positioned element is identified
10127
			doc = elem.ownerDocument;
10128
			offsetParent = elem.offsetParent || doc.documentElement;
10129
			while ( offsetParent &&
10130
				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
10131
				jQuery.css( offsetParent, "position" ) === "static" ) {
10132
10133
				offsetParent = offsetParent.parentNode;
10134
			}
10135
			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
10136
10137
				// Incorporate borders into its offset, since they are outside its content origin
10138
				parentOffset = jQuery( offsetParent ).offset();
10139
				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
10140
				parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
10141
			}
10142
		}
10143
10144
		// Subtract parent offsets and element margins
10145
		return {
10146
			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10147
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10148
		};
10149
	},
10150
10151
	// This method will return documentElement in the following cases:
10152
	// 1) For the element inside the iframe without offsetParent, this method will return
10153
	//    documentElement of the parent window
10154
	// 2) For the hidden or detached element
10155
	// 3) For body or html element, i.e. in case of the html node - it will return itself
10156
	//
10157
	// but those exceptions were never presented as a real life use-cases
10158
	// and might be considered as more preferable results.
10159
	//
10160
	// This logic, however, is not guaranteed and can change at any point in the future
10161
	offsetParent: function() {
10162
		return this.map( function() {
10163
			var offsetParent = this.offsetParent;
10164
10165
			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10166
				offsetParent = offsetParent.offsetParent;
10167
			}
10168
10169
			return offsetParent || documentElement;
10170
		} );
10171
	}
10172
} );
10173
10174
// Create scrollLeft and scrollTop methods
10175
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10176
	var top = "pageYOffset" === prop;
10177
10178
	jQuery.fn[ method ] = function( val ) {
10179
		return access( this, function( elem, method, val ) {
10180
10181
			// Coalesce documents and windows
10182
			var win;
10183
			if ( isWindow( elem ) ) {
10184
				win = elem;
10185
			} else if ( elem.nodeType === 9 ) {
10186
				win = elem.defaultView;
10187
			}
10188
10189
			if ( val === undefined ) {
10190
				return win ? win[ prop ] : elem[ method ];
10191
			}
10192
10193
			if ( win ) {
10194
				win.scrollTo(
10195
					!top ? val : win.pageXOffset,
10196
					top ? val : win.pageYOffset
10197
				);
10198
10199
			} else {
10200
				elem[ method ] = val;
10201
			}
10202
		}, method, val, arguments.length );
10203
	};
10204
} );
10205
10206
// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10207
// Add the top/left cssHooks using jQuery.fn.position
10208
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10209
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10210
// getComputedStyle returns percent when specified for top/left/bottom/right;
10211
// rather than make the css module depend on the offset module, just check for it here
10212
jQuery.each( [ "top", "left" ], function( i, prop ) {
10213
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10214
		function( elem, computed ) {
10215
			if ( computed ) {
10216
				computed = curCSS( elem, prop );
10217
10218
				// If curCSS returns percentage, fallback to offset
10219
				return rnumnonpx.test( computed ) ?
10220
					jQuery( elem ).position()[ prop ] + "px" :
10221
					computed;
10222
			}
10223
		}
10224
	);
10225
} );
10226
10227
10228
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10229
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10230
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10231
		function( defaultExtra, funcName ) {
10232
10233
		// Margin is only for outerHeight, outerWidth
10234
		jQuery.fn[ funcName ] = function( margin, value ) {
10235
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10236
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10237
10238
			return access( this, function( elem, type, value ) {
10239
				var doc;
10240
10241
				if ( isWindow( elem ) ) {
10242
10243
					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10244
					return funcName.indexOf( "outer" ) === 0 ?
10245
						elem[ "inner" + name ] :
10246
						elem.document.documentElement[ "client" + name ];
10247
				}
10248
10249
				// Get document width or height
10250
				if ( elem.nodeType === 9 ) {
10251
					doc = elem.documentElement;
10252
10253
					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10254
					// whichever is greatest
10255
					return Math.max(
10256
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10257
						elem.body[ "offset" + name ], doc[ "offset" + name ],
10258
						doc[ "client" + name ]
10259
					);
10260
				}
10261
10262
				return value === undefined ?
10263
10264
					// Get width or height on the element, requesting but not forcing parseFloat
10265
					jQuery.css( elem, type, extra ) :
10266
10267
					// Set width or height on the element
10268
					jQuery.style( elem, type, value, extra );
10269
			}, type, chainable ? margin : undefined, chainable );
10270
		};
10271
	} );
10272
} );
10273
10274
10275
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10276
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10277
	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
10278
	function( i, name ) {
10279
10280
	// Handle event binding
10281
	jQuery.fn[ name ] = function( data, fn ) {
10282
		return arguments.length > 0 ?
10283
			this.on( name, null, data, fn ) :
10284
			this.trigger( name );
10285
	};
10286
} );
10287
10288
jQuery.fn.extend( {
10289
	hover: function( fnOver, fnOut ) {
10290
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10291
	}
10292
} );
10293
10294
10295
10296
10297
jQuery.fn.extend( {
10298
10299
	bind: function( types, data, fn ) {
10300
		return this.on( types, null, data, fn );
10301
	},
10302
	unbind: function( types, fn ) {
10303
		return this.off( types, null, fn );
10304
	},
10305
10306
	delegate: function( selector, types, data, fn ) {
10307
		return this.on( types, selector, data, fn );
10308
	},
10309
	undelegate: function( selector, types, fn ) {
10310
10311
		// ( namespace ) or ( selector, types [, fn] )
10312
		return arguments.length === 1 ?
10313
			this.off( selector, "**" ) :
10314
			this.off( types, selector || "**", fn );
10315
	}
10316
} );
10317
10318
// Bind a function to a context, optionally partially applying any
10319
// arguments.
10320
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
10321
// However, it is not slated for removal any time soon
10322
jQuery.proxy = function( fn, context ) {
10323
	var tmp, args, proxy;
10324
10325
	if ( typeof context === "string" ) {
10326
		tmp = fn[ context ];
10327
		context = fn;
10328
		fn = tmp;
10329
	}
10330
10331
	// Quick check to determine if target is callable, in the spec
10332
	// this throws a TypeError, but we will just return undefined.
10333
	if ( !isFunction( fn ) ) {
10334
		return undefined;
10335
	}
10336
10337
	// Simulated bind
10338
	args = slice.call( arguments, 2 );
10339
	proxy = function() {
10340
		return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
10341
	};
10342
10343
	// Set the guid of unique handler to the same of original handler, so it can be removed
10344
	proxy.guid = fn.guid = fn.guid || jQuery.guid++;
10345
10346
	return proxy;
10347
};
10348
10349
jQuery.holdReady = function( hold ) {
10350
	if ( hold ) {
10351
		jQuery.readyWait++;
10352
	} else {
10353
		jQuery.ready( true );
10354
	}
10355
};
10356
jQuery.isArray = Array.isArray;
10357
jQuery.parseJSON = JSON.parse;
10358
jQuery.nodeName = nodeName;
10359
jQuery.isFunction = isFunction;
10360
jQuery.isWindow = isWindow;
10361
jQuery.camelCase = camelCase;
10362
jQuery.type = toType;
10363
10364
jQuery.now = Date.now;
10365
10366
jQuery.isNumeric = function( obj ) {
10367
10368
	// As of jQuery 3.0, isNumeric is limited to
10369
	// strings and numbers (primitives or objects)
10370
	// that can be coerced to finite numbers (gh-2662)
10371
	var type = jQuery.type( obj );
10372
	return ( type === "number" || type === "string" ) &&
10373
10374
		// parseFloat NaNs numeric-cast false positives ("")
10375
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
10376
		// subtraction forces infinities to NaN
10377
		!isNaN( obj - parseFloat( obj ) );
10378
};
10379
10380
10381
10382
10383
// Register as a named AMD module, since jQuery can be concatenated with other
10384
// files that may use define, but not via a proper concatenation script that
10385
// understands anonymous AMD modules. A named AMD is safest and most robust
10386
// way to register. Lowercase jquery is used because AMD module names are
10387
// derived from file names, and jQuery is normally delivered in a lowercase
10388
// file name. Do this after creating the global so that if an AMD module wants
10389
// to call noConflict to hide this version of jQuery, it will work.
10390
10391
// Note that for maximum portability, libraries that are not jQuery should
10392
// declare themselves as anonymous modules, and avoid setting a global if an
10393
// AMD loader is present. jQuery is a special case. For more information, see
10394
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10395
10396
if ( true ) {
10397
	!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
10398
		return jQuery;
10399
	}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
10400
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
10401
}
10402
10403
10404
10405
10406
var
10407
10408
	// Map over jQuery in case of overwrite
10409
	_jQuery = window.jQuery,
10410
10411
	// Map over the $ in case of overwrite
10412
	_$ = window.$;
10413
10414
jQuery.noConflict = function( deep ) {
10415
	if ( window.$ === jQuery ) {
10416
		window.$ = _$;
10417
	}
10418
10419
	if ( deep && window.jQuery === jQuery ) {
10420
		window.jQuery = _jQuery;
10421
	}
10422
10423
	return jQuery;
10424
};
10425
10426
// Expose jQuery and $ identifiers, even in AMD
10427
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10428
// and CommonJS for browser emulators (#13566)
10429
if ( !noGlobal ) {
10430
	window.jQuery = window.$ = jQuery;
10431
}
10432
10433
10434
10435
10436
return jQuery;
10437
} );
10438
10439
10440
/***/ }),
10441
/* 1 */,
10442
/* 2 */
10443
/***/ (function(module, exports, __webpack_require__) {
10444
10445
/* WEBPACK VAR INJECTION */(function($, jQuery) {$(document).ready(function () {
10446
10447
    /*
10448
     * jQuery accessible and keyboard-enhanced autocomplete list
10449
     * @version v1.6.0
10450
     * Website: https://a11y.nicolas-hoffmann.net/autocomplet-list/
10451
     * License MIT: https://github.com/nico3333fr/jquery-accessible-autocomplete-list-aria/blob/master/LICENSE
10452
     */
10453
    // loading combobox ------------------------------------------------------------------------------------------------------------
10454
    // init
10455
    var $js_combobox = $('.js-combobox'),
10456
        $body = $('body'),
10457
10458
    // default_text_help = 'Use tabulation (or down) key to access and browse suggestions after input. Confirm your choice with enter key, or esc key to close suggestions box.',
10459
    default_text_help = '',
10460
        default_class_for_invisible_text = 'invisible',
10461
        suggestion_single = 'There is ',
10462
        suggestion_plural = 'There are ',
10463
        suggestion_word = 'suggestion',
10464
        suggestion_word_plural = 'suggestions',
10465
        button_clear_title = 'clear this field',
10466
        button_clear_text = 'X',
10467
        case_sensitive = 'no',
10468
        min_length = 0,
10469
        limit_number_suggestions = 666,
10470
        search_option = 'beginning',
10471
        // or 'containing'
10472
    see_more_text = 'See more results…',
10473
        tablo_suggestions = [];
10474
10475
    function do_see_more_option() {
10476
        var $output_content = $('#js-codeit');
10477
        $output_content.html('You have to code a function or a redirection to display more results ;)');
10478
    }
10479
10480
    if ($js_combobox.length) {
10481
        // if there are at least one :)
10482
10483
        // init
10484
        $js_combobox.each(function (index_combo) {
10485
            var $this = $(this),
10486
                $this_id = $this.attr('id'),
10487
                $label_this = $('label[for="' + $this_id + '"]'),
10488
                index_lisible = index_combo + 1,
10489
                options = $this.data(),
10490
                $combobox_prefix_class = typeof options.comboboxPrefixClass !== 'undefined' ? options.comboboxPrefixClass + '-' : '',
10491
                $combobox_help_text = typeof options.comboboxHelpText !== 'undefined' ? options.comboboxHelpText : default_text_help,
10492
                $list_suggestions = $('#' + $this.attr('list')),
10493
                $combobox_button_title = typeof options.comboboxButtonTitle !== 'undefined' ? options.comboboxButtonTitle : button_clear_title,
10494
                $combobox_button_text = typeof options.comboboxButtonText !== 'undefined' ? options.comboboxButtonText : button_clear_text,
10495
                $combobox_case_sensitive = typeof options.comboboxCaseSensitive !== 'undefined' ? options.comboboxCaseSensitive : case_sensitive,
10496
                tablo_temp_suggestions = [];
10497
10498
            // input
10499
            $this.attr({
10500
                'data-number': index_lisible,
10501
                'autocorrect': 'off',
10502
                'autocapitalize': 'off',
10503
                'spellcheck': 'false',
10504
                'autocomplete': 'off',
10505
                'aria-describedby': $combobox_prefix_class + 'help-text' + index_lisible,
10506
                'aria-autocomplete': 'list',
10507
                'data-lastval': '',
10508
                'aria-owns': $combobox_prefix_class + 'suggest_' + index_lisible
10509
            });
10510
            // stock into tables
10511
            $list_suggestions.find('option').each(function (index_option, index_element) {
10512
                tablo_temp_suggestions.push(index_element.value);
10513
            });
10514
            if ($combobox_case_sensitive === 'no') {
10515
                // order case tablo_temp_suggestions
10516
                tablo_suggestions[index_lisible] = tablo_temp_suggestions.sort(function (a, b) {
10517
                    a = a.toLowerCase();
10518
                    b = b.toLowerCase();
10519
                    if (a == b) {
10520
                        return 0;
10521
                    }
10522
                    if (a > b) {
10523
                        return 1;
10524
                    }
10525
                    return -1;
10526
                });
10527
            } else {
10528
                tablo_suggestions[index_lisible] = tablo_temp_suggestions.sort();
10529
            }
10530
10531
            // wrap into a container
10532
            $this.wrap('<div class="' + $combobox_prefix_class + 'container js-container" data-combobox-prefix-class="' + $combobox_prefix_class + '"></div>');
10533
10534
            var $combobox_container = $this.parent();
10535
10536
            // custom datalist/listbox linked to input
10537
            $combobox_container.append('<div id="' + $combobox_prefix_class + 'suggest_' + index_lisible + '" class="js-suggest ' + $combobox_prefix_class + 'suggestions"><div role="listbox"></div></div>');
10538
            $list_suggestions.remove();
10539
10540
            // status zone
10541
            // $combobox_container.prepend('<div id="' + $combobox_prefix_class + 'suggestion-text' + index_lisible + '" class="js-suggestion-text ' + $combobox_prefix_class + 'suggestion-text ' + default_class_for_invisible_text + '" aria-live="assertive"></div>');
10542
10543
            // help text
10544
            $combobox_container.prepend('<span id="' + $combobox_prefix_class + 'help-text' + index_lisible + '" class="' + $combobox_prefix_class + 'help-text ' + default_class_for_invisible_text + '">' + $combobox_help_text + '</span>');
10545
10546
            // label id
10547
            $label_this.attr('id', 'label-id-' + $this_id);
10548
10549
            // button clear
10550
            $this.after('<button class="js-clear-button ' + $combobox_prefix_class + 'clear-button" aria-label="' + $combobox_button_title + '" title="' + $combobox_button_title + '" aria-describedby="label-id-' + $this_id + '" type="button">' + $combobox_button_text + '</button>');
10551
        });
10552
10553
        // listeners
10554
        // keydown on field
10555
        $body.on('keyup', '.js-combobox', function (event) {
10556
            var $this = $(this),
10557
                options_combo = $this.data(),
10558
                $container = $this.parent(),
10559
                $form = $container.parents('form'),
10560
                options = $container.data(),
10561
                $combobox_prefix_class = typeof options.comboboxPrefixClass !== 'undefined' ? options.comboboxPrefixClass : '',
10562
                // no "-"" because already generated
10563
            $suggestions = $container.find('.js-suggest div'),
10564
10565
            //$suggestion_list = $suggestions.find('.js-suggestion'),
10566
            $suggestions_text = $container.find('.js-suggestion-text'),
10567
                $combobox_suggestion_single = typeof options_combo.suggestionSingle !== 'undefined' ? options_combo.suggestionSingle : suggestion_single,
10568
                $combobox_suggestion_plural = typeof options_combo.suggestionPlural !== 'undefined' ? options_combo.suggestionPlural : suggestion_plural,
10569
                $combobox_suggestion_word = typeof options_combo.suggestionWord !== 'undefined' ? options_combo.suggestionWord : suggestion_word,
10570
                $combobox_suggestion_word_plural = typeof options_combo.suggestionWord !== 'undefined' ? options_combo.suggestionWordPlural : suggestion_word_plural,
10571
                combobox_min_length = typeof options_combo.comboboxMinLength !== 'undefined' ? Math.abs(options_combo.comboboxMinLength) : min_length,
10572
                $combobox_case_sensitive = typeof options_combo.comboboxCaseSensitive !== 'undefined' ? options_combo.comboboxCaseSensitive : case_sensitive,
10573
                combobox_limit_number_suggestions = typeof options_combo.comboboxLimitNumberSuggestions !== 'undefined' ? Math.abs(options_combo.comboboxLimitNumberSuggestions) : limit_number_suggestions,
10574
                $combobox_search_option = typeof options_combo.comboboxSearchOption !== 'undefined' ? options_combo.comboboxSearchOption : search_option,
10575
                $combobox_see_more_text = typeof options_combo.comboboxSeeMoreText !== 'undefined' ? options_combo.comboboxSeeMoreText : see_more_text,
10576
                index_table = $this.attr('data-number'),
10577
                value_to_search = $this.val(),
10578
                text_number_suggestions = '';
10579
10580
            if (event.keyCode === 13) {
10581
                $form.submit();
10582
            } else {
10583
10584
                if (event.keyCode !== 27) {
10585
                    // No Escape
10586
10587
                    $this.attr('data-lastval', value_to_search);
10588
                    // search for text suggestion in the array tablo_suggestions[index_table]
10589
                    var size_tablo = tablo_suggestions[index_table].length,
10590
                        i = 0,
10591
                        counter = 0;
10592
10593
                    $suggestions.empty();
10594
10595
                    if (value_to_search != '' && value_to_search.length >= combobox_min_length) {
10596
                        while (i < size_tablo) {
10597
                            if (counter < combobox_limit_number_suggestions) {
10598
                                if ($combobox_search_option === 'containing' && ($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].indexOf(value_to_search) >= 0 || $combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].toUpperCase().indexOf(value_to_search.toUpperCase()) >= 0) || $combobox_search_option === 'beginning' && ($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].substring(0, value_to_search.length) === value_to_search || $combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].substring(0, value_to_search.length).toUpperCase() === value_to_search.toUpperCase())) {
10599
                                    $suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + tablo_suggestions[index_table][i] + '</div>');
10600
                                    counter++;
10601
                                }
10602
                            }
10603
                            i++;
10604
                        }
10605
                        if (counter >= combobox_limit_number_suggestions) {
10606
                            $suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion js-seemore ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + $combobox_see_more_text + '</div>');
10607
                            counter++;
10608
                        }
10609
                        // update number of suggestions
10610
                        if (counter > 1) {
10611
                            text_number_suggestions = $combobox_suggestion_plural + counter + ' ' + $combobox_suggestion_word_plural + '.';
10612
                        }
10613
                        if (counter === 1) {
10614
                            text_number_suggestions = $combobox_suggestion_single + counter + ' ' + $combobox_suggestion_word + '.';
10615
                        }
10616
                        if (counter === 0) {
10617
                            text_number_suggestions = $combobox_suggestion_single + counter + ' ' + $combobox_suggestion_word + '.';
10618
                        }
10619
                        if (counter >= 0) {
10620
                            var text_number_suggestions_default = $suggestions_text.text();
10621
                            if (text_number_suggestions != text_number_suggestions_default) {
10622
                                // @Goestu trick to make it work on all AT
10623
                                var suggestions_to_add = $("<p>").text(text_number_suggestions);
10624
                                $suggestions_text.attr('aria-live', 'polite');
10625
                                $suggestions_text.empty();
10626
                                $suggestions_text.append(suggestions_to_add);
10627
                            }
10628
                        }
10629
                    }
10630
                }
10631
            }
10632
        }).on('click', function (event) {
10633
            var $target = $(event.target),
10634
                $suggestions_text = $('.js-suggestion-text:not(:empty)'),
10635
                // if a suggestion text is not empty => suggestion opened somewhere
10636
            $container = $suggestions_text.parents('.js-container'),
10637
                $input_text = $container.find('.js-combobox'),
10638
                $suggestions = $container.find('.js-suggest div');
10639
10640
            // if click outside => close opened suggestions 
10641
            if (!$target.is('.js-suggestion') && !$target.is('.js-combobox') && $suggestions_text.length) {
10642
                $input_text.val($input_text.attr('data-lastval'));
10643
                $suggestions.empty();
10644
                $suggestions_text.empty();
10645
            }
10646
        })
10647
        // tab + down management for autocomplete (when list of suggestion)
10648
        .on('keydown', '.js-combobox', function (event) {
10649
            var $this = $(this),
10650
                $container = $this.parent(),
10651
                $input_text = $container.find('.js-combobox'),
10652
                $suggestions = $container.find('.js-suggest div'),
10653
                $suggestion_list = $suggestions.find('.js-suggestion'),
10654
                $suggestions_text = $container.find('.js-suggestion-text'),
10655
                $autorise_tab_options = typeof $this.attr('data-combobox-notab-options') !== 'undefined' ? false : true,
10656
                $first_suggestion = $suggestion_list.first();
10657
10658
            if (!event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 40) {
10659
                // tab (if authorised) or bottom
10660
                // See if there are suggestions, and yes => focus on first one
10661
                if ($suggestion_list.length) {
10662
                    $input_text.val($first_suggestion.html());
10663
                    $suggestion_list.first().focus();
10664
                    event.preventDefault();
10665
                }
10666
            }
10667
            if (event.keyCode == 27 || $autorise_tab_options === false && event.keyCode == 9) {
10668
                // esc or (tab/shift tab + notab option) = close
10669
                $input_text.val($input_text.attr('data-lastval'));
10670
                $suggestions.empty();
10671
                $suggestions_text.empty();
10672
                if (event.keyCode == 27) {
10673
                    // Esc prevented only, tab can go :)
10674
                    event.preventDefault();
10675
                    setTimeout(function () {
10676
                        $input_text.focus();
10677
                    }, 300); // timeout to avoid problem in suggestions display
10678
                }
10679
            }
10680
        })
10681
        // tab + down management in list of suggestions
10682
        .on('keydown', '.js-suggestion', function (event) {
10683
            var $this = $(this),
10684
                $container = $this.parents('.js-container'),
10685
                $input_text = $container.find('.js-combobox'),
10686
                $autorise_tab_options = typeof $input_text.attr('data-combobox-notab-options') !== 'undefined' ? false : true,
10687
                $suggestions = $container.find('.js-suggest div'),
10688
                $suggestions_text = $container.find('.js-suggestion-text'),
10689
                $next_suggestion = $this.next(),
10690
                $previous_suggestion = $this.prev();
10691
10692
            if (event.keyCode == 27 || $autorise_tab_options === false && event.keyCode == 9) {
10693
                // esc or (tab/shift tab + notab option) = close
10694
                if (event.keyCode == 27) {
10695
                    // Esc prevented only, tab can go :)
10696
                    $input_text.val($input_text.attr('data-lastval'));
10697
                    $suggestions.empty();
10698
                    $suggestions_text.empty();
10699
                    setTimeout(function () {
10700
                        $input_text.focus();
10701
                    }, 300); // timeout to avoid problem in suggestions display
10702
                    event.preventDefault();
10703
                }
10704
                if ($autorise_tab_options === false && event.keyCode == 9) {
10705
                    $suggestions.empty();
10706
                    $suggestions_text.empty();
10707
                    $input_text.focus();
10708
                }
10709
            }
10710
            if (event.keyCode == 13 || event.keyCode == 32) {
10711
                // Enter or space
10712
                if ($this.hasClass('js-seemore')) {
10713
                    $input_text.val($input_text.attr('data-lastval'));
10714
                    $suggestions.empty();
10715
                    $suggestions_text.empty();
10716
                    setTimeout(function () {
10717
                        $input_text.focus();
10718
                    }, 300); // timeout to avoid problem in suggestions display
10719
                    // go define the function you need when we click the see_more option
10720
                    setTimeout(function () {
10721
                        do_see_more_option();
10722
                    }, 301); // timeout to avoid problem in suggestions display
10723
                    event.preventDefault();
10724
                } else {
10725
                    $input_text.val($this.html());
10726
                    $input_text.attr('data-lastval', $this.html());
10727
                    $suggestions.empty();
10728
                    $suggestions_text.empty();
10729
                    setTimeout(function () {
10730
                        $input_text.focus();
10731
                    }, 300); // timeout to avoid problem in suggestions display
10732
                    event.preventDefault();
10733
                }
10734
            }
10735
            if (!event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 40) {
10736
                // tab (if authorised) or bottom
10737
                if ($next_suggestion.length) {
10738
                    $input_text.val($next_suggestion.html());
10739
                    $next_suggestion.focus();
10740
                } else {
10741
                    $input_text.val($input_text.attr('data-lastval'));
10742
                    if (!event.shiftKey && event.keyCode == 9) {
10743
                        // tab closes the list
10744
                        var e = jQuery.Event("keydown");
10745
                        e.which = 27; // # Some key code value
10746
                        e.keyCode = 27;
10747
                        $this.trigger(e);
10748
                    } else {
10749
                        setTimeout(function () {
10750
                            $input_text.focus();
10751
                        }, 300);
10752
                    } // timeout to avoid problem in suggestions display
10753
                }
10754
                event.preventDefault();
10755
            }
10756
10757
            if (event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 38) {
10758
                // top or Maj+tab (if authorised)
10759
                if ($previous_suggestion.length) {
10760
                    $input_text.val($previous_suggestion.html());
10761
                    $previous_suggestion.focus();
10762
                } else {
10763
                    $input_text.val($input_text.attr('data-lastval')).focus();
10764
                }
10765
                event.preventDefault();
10766
            }
10767
        })
10768
        // clear button
10769
        .on('click', '.js-clear-button', function () {
10770
            var $this = $(this),
10771
                $container = $this.parent(),
10772
                $input_text = $container.find('.js-combobox'),
10773
                $suggestions = $container.find('.js-suggest div'),
10774
                $suggestions_text = $container.find('.js-suggestion-text');
10775
10776
            $suggestions.empty();
10777
            $suggestions_text.empty();
10778
            $input_text.val('');
10779
            $input_text.attr('data-lastval', '');
10780
        }).on('click', '.js-suggestion', function () {
10781
            var $this = $(this),
10782
                value = $this.html(),
10783
                $container = $this.parents('.js-container'),
10784
                $input_text = $container.find('.js-combobox'),
10785
                $suggestions = $container.find('.js-suggest div'),
10786
                $suggestions_text = $container.find('.js-suggestion-text');
10787
10788
            if ($this.hasClass('js-seemore')) {
10789
                $suggestions.empty();
10790
                $suggestions_text.empty();
10791
                $input_text.focus();
10792
                // go define the function you need when we click the see_more option
10793
                do_see_more_option();
10794
            } else {
10795
                $input_text.val(value).focus();
10796
                $suggestions.empty();
10797
                $suggestions_text.empty();
10798
            }
10799
        });
10800
    }
10801
});
10802
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(0)))
10803
10804
/***/ }),
10805
/* 3 */,
10806
/* 4 */,
10807
/* 5 */,
10808
/* 6 */
10809
/***/ (function(module, exports, __webpack_require__) {
10810
10811
module.exports = __webpack_require__(2);
10812
10813
10814
/***/ })
10815
/******/ ]);